input: Write a function to construct a neural network model in Python using the Keras library to classify the MNIST dataset correctly. The function should define the layers of the model, compile the model with appropriate settings, and return the compiled model.
  assert construct_mnist_model().__class__.__name__ == 'Model'
  assert len(construct_mnist_model().layers) == 3
  assert construct_mnist_model().optimizer.__class__.__name__ == 'Adam'
  assert construct_mnist_model().loss == 'sparse_categorical_crossentropy'
output: def construct_mnist_model():
      from tensorflow.keras.models import Sequential
      from tensorflow.keras.layers import Dense, Flatten
      from tensorflow.keras.optimizers import Adam
      
      model = Sequential()
      model.add(Flatten(input_shape=(28, 28)))
      model.add(Dense(128, activation='relu'))
      model.add(Dense(10, activation='softmax'))
      
      model.compile(optimizer=Adam(), loss='sparse_categorical_crossentropy', metrics=['accuracy'])
      
      return model