input: def Matrix_Operations(matrix_class: str) -> None:
      """
      Given the definition of the Matrix class, ensure it correctly performs matrix operations like addition, subtraction, multiplication, and transpose.
      
      >>> matrix1 = Matrix(2, 2, [1, 2, 3, 4])
      >>> matrix2 = Matrix(2, 2, [5, 6, 7, 8])
      >>> matrix1.add(matrix2)
      >>> print(matrix1)
      6 8 
      10 12 
      
      >>> matrix3 = Matrix(2, 2, [1, 2, 3, 4])
      >>> matrix4 = Matrix(2, 2, [5, 6, 7, 8])
      >>> matrix3.sub(matrix4)
      >>> print(matrix3)
      -4 -4 
      -4 -4 
      
      >>> matrix5 = Matrix(2, 3, [1, 2, 3, 4, 5, 6])
      >>> matrix6 = Matrix(3, 2, [7, 8, 9, 10, 11, 12])
      >>> matrix5.mul(matrix6)
      >>> print(matrix5)
      58 64 
      139 154 
      
      >>> matrix7 = Matrix(2, 2, [1, 2, 3, 4])
      >>> matrix7.transpose()
      >>> print(matrix7)
      1 3 
      2 4 
      """
output:     class Matrix:
          def __init__(self, rows: int, cols: int, data: List[int]):
              self.rows = rows
              self.cols = cols
              self.data = data
  
          def add(self, other: 'Matrix') -> None:
              if self.rows != other.rows or self.cols != other.cols:
                  raise ValueError("Matrices must have the same dimensions for addition.")
              self.data = [a + b for a, b in zip(self.data, other.data)]
  
          def sub(self, other: 'Matrix') -> None:
              if self.rows != other.rows or self.cols != other.cols:
                  raise ValueError("Matrices must have the same dimensions for subtraction.")
              self.data = [a - b for a, b in zip(self.data, other.data)]
  
          def mul(self, other: 'Matrix') -> None:
              if self.cols != other.rows:
                  raise ValueError("Number of columns in the first matrix must be equal to the number of rows in the second matrix.")
              result = []
              for i in range(self.rows):
                  for j in range(other.cols):
                      sum = 0
                      for k in range(self.cols):
                          sum += self.data[i * self.cols + k] * other.data[k * other.cols + j]
                      result.append(sum)
              self.data = result
              self.cols = other.cols
  
          def transpose(self) -> None:
              new_data = []
              for j in range(self.cols):
                  for i in range(self.rows):
                      new_data.append(self.data[i * self.cols + j])
              self.data = new_data
              self.rows, self.cols = self.cols, self.rows
  
          def __str__(self) -> str:
              return '\n'.join(' '.join(str(self.data[i * self.cols + j]) for j in range(self.cols)) for i in range(self.rows))