input: def MatrixOperations(matrix1, matrix2, operation):
      """Perform various matrix operations such as addition, subtraction, multiplication, and transpose.
      Given two matrices and an operation, return the result of the specified matrix operation.
      The operation can be one of: 'add', 'sub', 'mul', 'transpose'.
      If the operation is 'transpose', only the first matrix will be used.
      The matrices should be given as a list of lists.
  
      Example:
      >>> MatrixOperations([[1, 2], [3, 4]], [[5, 6], [7, 8]], 'add')
      [[6, 8], [10, 12]]
      >>> MatrixOperations([[1, 2], [3, 4]], [[5, 6], [7, 8]], 'sub')
      [[-4, -4], [-4, -4]]
      >>> MatrixOperations([[1, 2], [3, 4]], [[5, 6], [7, 8]], 'mul')
      [[19, 22], [43, 50]]
      >>> MatrixOperations([[1, 2], [3, 4]], [], 'transpose')
      [[1, 3], [2, 4]]
      """
      result = []
      if operation == 'add':
          result = [[matrix1[i][j] + matrix2[i][j] for j in range(len(matrix1[0]))] for i in range(len(matrix1))]
      elif operation == 'sub':
          result = [[matrix1[i][j] - matrix2[i][j] for j in range(len(matrix1[0]))] for i in range(len(matrix1))]
      elif operation == 'mul':
          result = [[sum(matrix1[i][k] * matrix2[k][j] for k in range(len(matrix1[0]))) for j in range(len(matrix2[0]))] for i in range(len(matrix1))]
      elif operation == 'transpose':
          result = [[matrix1[j][i] for j in range(len(matrix1))] for i in range(len(matrix1[0]))]
      return result
output:     result = []
      if operation == 'add':
          result = [[matrix1[i][j] + matrix2[i][j] for j in range(len(matrix1[0]))] for i in range(len(matrix1))]
      elif operation == 'sub':
          result = [[matrix1[i][j] - matrix2[i][j] for j in range(len(matrix1[0]))] for i in range(len(matrix1))]
      elif operation == 'mul':
          result = [[sum(matrix1[i][k] * matrix2[k][j] for k in range(len(matrix1[0]))) for j in range(len(matrix2[0]))] for i in range(len(matrix1))]
      elif operation == 'transpose':
          result = [[matrix1[j][i] for j in range(len(matrix1))] for i in range(len(matrix1[0]))]
      return result