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, preprocess the data, and train a Logistic Regression classifier. If the model is trained successfully, return the trained model; otherwise, return None.
  assert generate_mnist_model() is not None
output: def generate_mnist_model():
      from sklearn.datasets import load_digits
      from sklearn.model_selection import train_test_split
      from sklearn.preprocessing import StandardScaler
      from sklearn.linear_model import LogisticRegression
  
      digits = load_digits()
      X_train, _, y_train, _ = train_test_split(digits.data, digits.target, test_size=0.2, random_state=42)
      
      scaler = StandardScaler()
      X_train = scaler.fit_transform(X_train)
      
      try:
          model = LogisticRegression(max_iter=1000)
          model.fit(X_train, y_train)
          return model
      except Exception as e:
          return None