input: Write a function to create and train a multi-layer perceptron model using Keras to classify MNIST handwritten digits. The function should load the MNIST dataset, split it into input and output variables, define the model architecture, compile the model with an appropriate loss function and optimizer, fit the model on the training data, and finally evaluate the model's performance. Return the evaluation accuracy. If the dataset is not loaded correctly, return an error message.
  assert train_mnist_model() > 0.90
  assert train_mnist_model() == -1 if dataset_not_loaded
output: def train_mnist_model():
      try:
          from tensorflow.keras.datasets import mnist
          from tensorflow.keras.models import Sequential
          from tensorflow.keras.layers import Dense, Flatten
          from tensorflow.keras.utils import to_categorical
          from tensorflow.keras.optimizers import Adam
  
          (x_train, y_train), (x_test, y_test) = mnist.load_data()
          x_train = x_train.reshape(-1, 28*28) / 255.0
          x_test = x_test.reshape(-1, 28*28) / 255.0
          y_train = to_categorical(y_train, 10)
          y_test = to_categorical(y_test, 10)
  
          model = Sequential([
              Flatten(input_shape=(28*28,)),
              Dense(128, activation='relu'),
              Dense(64, activation='relu'),
              Dense(10, activation='softmax')
          ])
  
          model.compile(optimizer=Adam(), loss='categorical_crossentropy', metrics=['accuracy'])
          model.fit(x_train, y_train, epochs=10, batch_size=32, validation_split=0.2)
  
          _, accuracy = model.evaluate(x_test, y_test)
          return accuracy
      except Exception as e:
          return -1