def _reconstruct_path(target_candidate, scanned):
    """
    Reconstruct a path from the scanned table, and return the path
    sequence.
    """
    path = []
    candidate = target_candidate
    while candidate is not None:
        path.append(candidate)
        candidate = scanned[candidate.id]
    return path