input: Write a function to implement a logistic regression classifier in Python to classify handwritten digits from the MNIST dataset. The function should load the MNIST dataset, prepare the data for logistic regression, define the logistic regression model, and calculate the training, validation, and test accuracies.
  assert LogisticRegression("mnist_dataset/mnist.pkl.gz")=='Train accuracy =  0.9264', 'Validation accuracy =  0.9236', 'Test accuracy =  0.9252'
output: 
  def LogisticRegression(filename):
      import gzip
      import pickle
      import numpy as np
      from sklearn.linear_model import LogisticRegression
      from sklearn.model_selection import train_test_split
  
      with gzip.open(filename, 'rb') as f:
          data = pickle.load(f, encoding='latin1')
      
      X_train, y_train = data['train_data'], data['train_labels']
      X_val, y_val = data['validation_data'], data['validation_labels']
      X_test, y_test = data['test_data'], data['test_labels']
      
      model = LogisticRegression(max_iter=200)
      model.fit(X_train, y_train)
      
      train_accuracy = model.score(X_train, y_train)
      val_accuracy = model.score(X_val, y_val)
      test_accuracy = model.score(X_test, y_test)
      
      return f'Train accuracy =  {train_accuracy:.4f}', f'Validation accuracy =  {val_accuracy:.4f}', f'Test accuracy =  {test_accuracy:.4f}'
  