def _parse_list_line(line, files=[], subdirs=[], links=None):
    """Parse *line* and insert into either *files* or *subdirs* depending on
    whether the line is for a directory or not.

    This is used as the callback to the ftplib.FTPConnection.dir callback.
    """
    dst = None
    if line.startswith('d'):
        dst = subdirs
    elif line.startswith('-'):
        dst = files
    elif line.startswith('l'):
        dst = links
    else:
        raise ValueError('unknown line type %r' % line[:1])
    if dst is None:
        return
    parts = line.split(None, 8)
    stat, name = parts[0], parts[-1]
    dst.append(name)
