def deploy_ftp(deploy_configs):
    '''for ftp'''
    conn_kwargs = {'host': deploy_configs['host']}
    login_kwargs = {}
    if 'port' in deploy_configs:
        conn_kwargs.update({'port': deploy_configs['port']})
    if 'user' in deploy_configs:
        login_kwargs.update({'user': deploy_configs['user']})
    if 'password' in deploy_configs:
        passwd = deploy_configs['password']
        # when set password key with no value, get None by yaml
        if passwd is None:
            passwd = getpass.getpass('Input your ftp password: ')
        login_kwargs.update({'passwd': passwd})

    ftp_dir = deploy_configs.get('dir', '/')
    output_dir = configs['destination']

    ftp = ftplib.FTP()
    ftp.connect(**conn_kwargs)
    ftp.login(**login_kwargs)

    for root, dirs, files in os.walk(output_dir):
        rel_root = os.path.relpath(root, output_dir)
        for fn in files:
            store_fn = os.path.join(ftp_dir, rel_root, fn)
            ftp.storbinary('STOR %s' % store_fn,
                           open(os.path.join(root, fn), 'rb'))

    ftp.close()
dataset/ETHPy150Open tankywoo/simiki/simiki/conf_templates/fabfile.py/deploy_ftp/original