input: from typing import List, List
  
  def matrix_multiplication(A: List[List[float]], B: List[List[float]]) -> List[List[float]]:
      """ Multiplies two given matrices and returns the resulting matrix.
      >>> matrix_multiplication([[1, 2], [3, 4]], [[5, 6], [7, 8]])
      [[19, 22], [43, 50]]
      >>> matrix_multiplication([[1, 0], [0, 1]], [[0, 1], [1, 0]])
      [[0, 1], [1, 0]]
      """
output:     rows_A = len(A)
      cols_A = len(A[0])
      rows_B = len(B)
      cols_B = len(B[0])
      
      if cols_A != rows_B:
          raise ValueError("The number of columns in matrix A must be equal to the number of rows in matrix B.")
      
      result = [[0 for _ in range(cols_B)] for _ in range(rows_A)]
      
      for i in range(rows_A):
          for j in range(cols_B):
              for k in range(cols_A):
                  result[i][j] += A[i][k] * B[k][j]
      
      return result