input: Write a python function to define, compile, and fit a neural network model using TensorFlow, and test the function with given training data.
  assert model.summary() is not None
  assert isinstance(model.layers[0], tf.keras.layers.Input)
  assert isinstance(model.layers[-1], tf.keras.layers.Dense)
output: import tensorflow as tf
  
  def build_and_train_model(X_train, y_train, input_shape, num_classes, epochs=10, batch_size=32):
      model = tf.keras.Sequential([
          tf.keras.layers.Input(shape=input_shape),
          tf.keras.layers.Dense(128, activation='relu'),
          tf.keras.layers.Dense(num_classes, activation='softmax')
      ])
  
      model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
      
      model.fit(X_train, y_train, epochs=epochs, batch_size=batch_size, verbose=0)
  
      return model