def _GetHoles(i, n, cont, assigned):
    """Find holes for path i: i.e., unassigned paths directly inside it.

    Directly inside means there is not some other unassigned path k
    such that path such that path i contains k and path k contains j.
    (If such a k is already assigned, then its islands have been assigned too.)

    Args:
      i: int - index of a boundary path
      n: int - total number of paths
      cont: dict - maps path pairs (i,j) to _Contains(i,j,...) result
      assigned: set  of int - which paths are already assigned
    Returns:
      list of int - indices of paths that are islands
    Side Effect:
      Adds island indices to assigned set.
    """

    isls = []
    for j in range(0, n):
        if j in assigned:
            continue   # catches i==j too, since i is assigned by now
        if (i, j) in cont:
            directly = True
            for k in range(0, n):
                if k == j or k in assigned:
                    continue
                if (i, k) in cont and (k, j) in cont:
                    directly = False
                    break
            if directly:
                isls.append(j)
                assigned.add(j)
    return isls