input: Write a function to construct a neural network model in Python using Keras to classify the MNIST data set correctly. The function should return the compiled model. If the model is compiled successfully, it should be ready for training.
  assert construct_mnist_model().compile().optimizer.__class__ == keras.optimizers.Adam
  assert construct_mnist_model().compile().loss == 'sparse_categorical_crossentropy'
  assert construct_mnist_model().compile().metrics == ['accuracy']
output: def construct_mnist_model():
      from tensorflow.keras import layers, models
      model = models.Sequential([
          layers.Input(shape=(28, 28, 1)),
          layers.Conv2D(32, (3, 3), activation='relu'),
          layers.MaxPooling2D((2, 2)),
          layers.Conv2D(64, (3, 3), activation='relu'),
          layers.MaxPooling2D((2, 2)),
          layers.Flatten(),
          layers.Dense(64, activation='relu'),
          layers.Dense(10, activation='softmax')
      ])
      model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
      return model