input: Write a function to generate and train a machine learning model in Python using scikit-learn for classifying digits in the MNIST dataset. Return the trained model.
  assert generate_mnist_model()!=None
  assert generate_mnist_model().predict([[0]*784])[0] in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
output: def generate_mnist_model():
      from sklearn.datasets import fetch_openml
      from sklearn.model_selection import train_test_split
      from sklearn.ensemble import RandomForestClassifier
      from sklearn.metrics import accuracy_score
  
      mnist = fetch_openml('mnist_784', version=1)
      X, y = mnist["data"], mnist["target"]
      X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
  
      model = RandomForestClassifier(n_estimators=100, random_state=42)
      model.fit(X_train, y_train)
  
      return model