input: Write a function to build and train an LSTM model for sentiment analysis on IMDB dataset using Keras.
  assert type(build_and_train_model()) == tuple
  assert len(build_and_train_model()) == 2
  assert build_and_train_model()[0] > 0.5
output: def build_and_train_model():
      import numpy as np
      from keras.datasets import imdb
      from keras.models import Sequential
      from keras.layers import Embedding, LSTM, Dense
      from keras.preprocessing.sequence import pad_sequences
  
      # Load the dataset
      num_words = 10000
      (X_train, y_train), (X_test, y_test) = imdb.load_data(num_words=num_words)
  
      # Pad sequences to ensure uniform input length
      maxlen = 300
      X_train = pad_sequences(X_train, maxlen=maxlen)
      X_test = pad_sequences(X_test, maxlen=maxlen)
  
      # Build the LSTM model
      model = Sequential()
      model.add(Embedding(input_dim=num_words, output_dim=128, input_length=maxlen))
      model.add(LSTM(128, return_sequences=False))
      model.add(Dense(1, activation='sigmoid'))
  
      # Compile the model
      model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])
  
      # Train the model
      history = model.fit(X_train, y_train, epochs=3, batch_size=64, validation_data=(X_test, y_test))
  
      # Evaluate the model
      test_loss, test_accuracy = model.evaluate(X_test, y_test)
  
      return test_accuracy, history