input: Write a function to implement a Machine Learning model in Python which can recognize handwritten digits from 0 to 9 using TensorFlow. The function should load the MNIST dataset, define a neural network model, preprocess the data, compile the model, and then fit the model.
  assert mnist_digit_recognizer() is not None
output: def mnist_digit_recognizer():
      import tensorflow as tf
      from tensorflow.keras import layers, models
  
      (x_train, y_train), (x_test, y_test) = tf.keras.datasets.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
  
      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='adam',
                    loss='sparse_categorical_crossentropy',
                    metrics=['accuracy'])
  
      model.fit(x_train, y_train, epochs=5, batch_size=64, validation_data=(x_test, y_test))
  
      return model