def binary_path_to_coordinates(path):
  """Using tree path to the leaf node retrieve (x, y) coordinates.

  Reassembles the path into coordinates. Note that if the path is shorter,
  e.g. for leafs closer to the tree root, the (x, y) coordinates would be
  w.r.t. to the image of the size 2^b x 2^b, where b = `path coordinate bits`.
  Args:
    path: binary path of the location ('00/01')

  Returns:
    x coordinate, y coordinate, total bit level.
  """

  x = 0
  y = 0
  splitted_path = path.split('/')
  for xy in splitted_path:
    x = x << 1
    y = y << 1
    x += int(xy[0])
    y += int(xy[1])
  return (x, y, len(splitted_path))