input: Write a python function to create and train a simple neural network model using Keras with MNIST dataset.
  assert isinstance(create_and_train_model(), keras.models.Sequential)
  assert create_and_train_model().layers[0].units == 32
  assert create_and_train_model().layers[-1].units == 10
output: def create_and_train_model():
      from keras.datasets import mnist
      from keras.models import Sequential
      from keras.layers import Dense, Flatten
      from keras.utils import to_categorical
  
      # Load and preprocess the MNIST dataset
      (x_train, y_train), (x_test, y_test) = mnist.load_data()
      x_train = x_train.astype('float32') / 255
      x_test = x_test.astype('float32') / 255
      y_train = to_categorical(y_train, 10)
      y_test = to_categorical(y_test, 10)
  
      # Create the model
      model = Sequential()
      model.add(Flatten(input_shape=(28, 28)))
      model.add(Dense(32, activation='relu'))
      model.add(Dense(10, activation='softmax'))
  
      # Compile the model
      model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
  
      # Train the model
      model.fit(x_train, y_train, epochs=5, batch_size=32, validation_data=(x_test, y_test))
  
      return model