input: Write a function to find the shortest path between two given points in a matrix. The function should return the length of the shortest path. If no path exists, return -1. The path can only traverse through cells with a value of 0 in the matrix.
  
  def shortest_path(matrix, start, end):
    queue = []
    min_len = math.inf
    queue.append([start])
    while queue:
      path = queue.pop(0)
      x, y = path[-1]
      if (x, y) == end:
        if len(path) < min_len:
          min_len = len(path)
      for dx, dy in [[-1, 0], [1, 0], [0, -1], [0, 1]]:
        new_x, new_y = x + dx, y + dy
        if 0 <= new_x < len(matrix) and 0 <= new_y < len(matrix[0]):
          if matrix[new_x][new_y] == 0:
            queue.append(path + [(new_x, new_y)])
    return min_len if min_len != math.inf else -1
  
  assert shortest_path([[0, 0, 0], [1, 1, 0], [1, 1, 0]], (0, 0), (2, 2)) == 4
  assert shortest_path([[0, 1, 0], [1, 1, 1], [0, 0, 0]], (0, 0), (2, 2)) == -1
  assert shortest_path([[0, 0, 0], [0, 1, 0], [0, 0, 0]], (0, 0), (2, 2)) == 4
output: def shortest_path(matrix, start, end):
    queue = []
    min_len = math.inf
    queue.append([start])
    while queue:
      path = queue.pop(0)
      x, y = path[-1]
      if (x, y) == end:
        if len(path) < min_len:
          min_len = len(path)
      for dx, dy in [[-1, 0], [1, 0], [0, -1], [0, 1]]:
        new_x, new_y = x + dx, y + dy
        if 0 <= new_x < len(matrix) and 0 <= new_y < len(matrix[0]):
          if matrix[new_x][new_y] == 0:
            queue.append(path + [(new_x, new_y)])
    return min_len if min_len != math.inf else -1