input: Write a function to perform matrix multiplication on two given matrices, A and B. The function should return the resulting matrix. If the matrices cannot be multiplied due to incompatible dimensions, the function should raise a ValueError.
  
  def matrix_multiplication(A, B):
      if len(A[0]) != len(B):
          raise ValueError("Matrices cannot be multiplied")
      result = [[0 for j in range(len(B[0]))] for i in range(len(A))]
      for i in range(len(A)):
          for j in range(len(B[0])):
              for k in range(len(B)):
                  result[i][j] += A[i][k] * B[k][j]
      return result
  
  assert matrix_multiplication([[1, 2], [3, 4]], [[5, 6], [7, 8]]) == [[19, 22], [43, 50]]
  assert matrix_multiplication([[1, 2]], [[5], [6]]) == [[17]]
  assert matrix_multiplication([[1, 2, 3]], [[4], [5], [6]]) == [[32]]
  assert matrix_multiplication([[1], [2]], [[3, 4]]) == [[3, 4], [6, 8]]
  try:
      matrix_multiplication([[1, 2]], [[5], [6], [7]])
      assert False
  except ValueError:
      assert True
output: 
  def matrix_multiplication(A, B):
      if len(A[0]) != len(B):
          raise ValueError("Matrices cannot be multiplied")
      result = [[0 for j in range(len(B[0]))] for i in range(len(A))]
      for i in range(len(A)):
          for j in range(len(B[0])):
              for k in range(len(B)):
                  result[i][j] += A[i][k] * B[k][j]
      return result
  