input: Write a function to generate a machine learning model in Python using scikit-learn for classifying digits in the MNIST dataset. The function should load the dataset, split it into features and labels, reshape the features, create and train a Logistic Regression classifier, and return the trained model. If the dataset is empty or cannot be loaded, the function should return None.
  assert generate_mnist_model() is not None
  assert generate_mnist_model().score(X, y) > 0.85
  assert generate_mnist_model().predict([X[0]]) == [y[0]]
  assert generate_mnist_model().predict([X[1]]) == [y[1]]
  assert generate_mnist_model().predict([X[2]]) == [y[2]]
output: def generate_mnist_model():
      from sklearn.datasets import load_digits
      from sklearn.linear_model import LogisticRegression
      from sklearn.model_selection import train_test_split
      import numpy as np
      
      try:
          digits = load_digits()
          if len(digits.data) == 0:
              return None
          
          X = digits.data
          y = digits.target
          
          X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
          
          model = LogisticRegression(max_iter=1000)
          model.fit(X_train, y_train)
          
          return model
      except Exception as e:
          return None