input: Write a python function to train a Convolutional Neural Network on the MNIST dataset.
  assert isinstance(model, keras.Sequential)
  assert model.evaluate(x_test, y_test, verbose=0)[1] >= 0.9
output: def train_mnist_cnn():
      import tensorflow as tf
      from tensorflow import keras
      from tensorflow.keras import layers
      
      # Load the MNIST dataset
      (x_train, y_train), (x_test, y_test) = keras.datasets.mnist.load_data()
      
      # Normalize the images to [0, 1] range
      x_train = x_train.astype("float32") / 255
      x_test = x_test.astype("float32") / 255
      
      # Add a channels dimension
      x_train = x_train[..., tf.newaxis]
      x_test = x_test[..., tf.newaxis]
      
      # Build the model
      model = keras.Sequential([
          layers.Conv2D(32, kernel_size=(3, 3), activation="relu", input_shape=(28, 28, 1)),
          layers.MaxPooling2D(pool_size=(2, 2)),
          layers.Conv2D(64, kernel_size=(3, 3), activation="relu"),
          layers.MaxPooling2D(pool_size=(2, 2)),
          layers.Flatten(),
          layers.Dense(128, activation="relu"),
          layers.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, batch_size=128, validation_split=0.1)
      
      return model
  
  model = train_mnist_cnn()