input: Write a function that generates a neural network model using TensorFlow and Python to classify hand-written digits from the MNIST dataset. The function should include parameters for learning rate, training epochs, batch size, and display step. It should also initialize weights and biases, define the model architecture, construct the model, define the loss and optimizer, train the model, and finally test the model for accuracy.
  assert generate_mnist_model(0.001, 15, 100, 1) != None
  assert generate_mnist_model(0.01, 10, 50, 2) != None
  assert generate_mnist_model(0.0001, 20, 200, 5) != None
  assert generate_mnist_model(0.1, 5, 10, 1) != None
  assert generate_mnist_model(0.005, 25, 25, 3) != None
output: def generate_mnist_model(learning_rate, epochs, batch_size, display_step):
      import tensorflow as tf
      from tensorflow.keras import layers, models
      from tensorflow.keras.datasets import mnist
      from tensorflow.keras.utils import to_categorical
  
      (x_train, y_train), (x_test, y_test) = mnist.load_data()
      x_train = x_train.reshape((x_train.shape[0], 28, 28, 1)).astype('float32') / 255
      x_test = x_test.reshape((x_test.shape[0], 28, 28, 1)).astype('float32') / 255
      y_train = to_categorical(y_train)
      y_test = to_categorical(y_test)
  
      model = models.Sequential([
          layers.Conv2D(32, (3, 3), activation='relu', input_shape=(28, 28, 1)),
          layers.MaxPooling2D((2, 2)),
          layers.Conv2D(64, (3, 3), activation='relu'),
          layers.MaxPooling2D((2, 2)),
          layers.Conv2D(64, (3, 3), activation='relu'),
          layers.Flatten(),
          layers.Dense(64, activation='relu'),
          layers.Dense(10, activation='softmax')
      ])
  
      model.compile(optimizer=tf.keras.optimizers.Adam(learning_rate=learning_rate),
                    loss='categorical_crossentropy',
                    metrics=['accuracy'])
  
      model.fit(x_train, y_train, epochs=epochs, batch_size=batch_size, verbose=0)
  
      test_loss, test_acc = model.evaluate(x_test, y_test, verbose=0)
      return test_acc