'Input task handler'

def on_task_input(self, task, config):

    dependency_check()
    config = self.prepare_config(config)
    files_only = config[u'files_only']
    recursive = config[u'recursive']
    get_size = config[u'get_size']
    private_key = config[u'private_key']
    private_key_pass = config[u'private_key_pass']
    dirs = config[u'dirs']
    if (not isinstance(dirs, list)):
        dirs = [dirs]
    log.debug((u'Connecting    to    %s' % config[u'host']))
    sftp = sftp_from_config(config)
    url_prefix = sftp_prefix(config)
    entries = []
    def file_size(path):
        u'\n                                                Helper    function    to    get    the    size    of    a    node\n                                                '
        return sftp.lstat(path).st_size
    def dir_size(path):
        u'\n                                                Walk    a    directory    to    get    its    size\n                                                '
        sizes = []
        def node_size(f):
            sizes.append(file_size(f))
        sftp.walktree(path, node_size, node_size, node_size, True)
        size = sum(sizes)
        return size
    def handle_node(path, size_handler, is_dir):
        u'\n                                                Generic    helper    function    for    handling    a    remote    file    system    node\n                                                '
        if (is_dir and files_only):
            return
        url = urljoin(url_prefix, sftp.normalize(path))
        title = remotepath.basename(path)
        entry = Entry(title, url)
        if get_size:
            try:
                size = size_handler(path)
            except Exception as e:
                log.error((u'Failed    to    get    size    for    %s    (%s)' % (path, e)))
                size = (-1)
            entry[u'content_size'] = size
        if private_key:
            entry[u'private_key'] = private_key
            if private_key_pass:
                entry[u'private_key_pass'] = private_key_pass
        entries.append(entry)
    handle_file = partial(handle_node, size_handler=file_size, is_dir=False)
    handle_dir = partial(handle_node, size_handler=dir_size, is_dir=True)
    def handle_unknown(path):
        u'\n                                                Skip    unknown    files\n                                                '
        log.warning((u'Skipping    unknown    file:    %s' % path))
    for dir in dirs:
        try:
            sftp.walktree(dir, handle_file, handle_dir, handle_unknown, recursive)
        except IOError as e:
            log.error((u'Failed    to    open    %s    (%s)' % (dir, e)))
            continue
    sftp.close()
    return entries
