def _path2map(path, targ_length):
    """
    Turn a path into a list of lists mapping target scans to one or more
    reference scans.
    """
    idx_map = [[] for x in range(targ_length)]
    for step in path:
        idx_map[step[1]].append(step[0])

    return idx_map