input: Write a python function to build, compile and train a neural network model using TensorFlow's MNIST dataset.
  assert build_and_train_model() is not None
output: def build_and_train_model():
      import tensorflow as tf
      from tensorflow.keras.models import Sequential
      from tensorflow.keras.layers import Dense, Flatten
      from tensorflow.keras.optimizers import Adam
  
      # Load and preprocess the MNIST dataset
      (x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
      x_train, x_test = x_train / 255.0, x_test / 255.0
      
      # Build the neural network model
      model = Sequential([
          Flatten(input_shape=(28, 28)),
          Dense(128, activation='relu'),
          Dense(10, activation='softmax')
      ])
      
      # Compile the model
      model.compile(optimizer=Adam(),
                    loss='sparse_categorical_crossentropy',
                    metrics=['accuracy'])
      
      # Train the model
      model.fit(x_train, y_train, epochs=5, validation_data=(x_test, y_test))
  
      return model