input: Write a python function to build and train a Keras model for sentiment analysis on the IMDB dataset.
  assert isinstance(build_and_train_model()[0], keras.models.Sequential)
  assert build_and_train_model()[1] > 0.5
output: def build_and_train_model():
      from keras.datasets import imdb
      from keras.preprocessing import sequence
      from keras.models import Sequential
      from keras.layers import Embedding, LSTM, Dense
      from keras.optimizers import Adam
      
      # Load the IMDB dataset
      max_features = 20000
      max_len = 80
      
      (x_train, y_train), (x_test, y_test) = imdb.load_data(num_words=max_features)
      
      # Pad sequences
      x_train = sequence.pad_sequences(x_train, maxlen=max_len)
      x_test = sequence.pad_sequences(x_test, maxlen=max_len)
      
      # Build the model
      model = Sequential()
      model.add(Embedding(max_features, 128, input_length=max_len))
      model.add(LSTM(128, dropout=0.2, recurrent_dropout=0.2))
      model.add(Dense(1, activation='sigmoid'))
      
      # Compile the model
      model.compile(loss='binary_crossentropy', optimizer=Adam(), metrics=['accuracy'])
      
      # Train the model
      model.fit(x_train, y_train, batch_size=32, epochs=3, validation_data=(x_test, y_test))
      
      # Evaluate the model
      score, acc = model.evaluate(x_test, y_test, batch_size=32)
      
      return model, acc