def ftp_download(url, download_file, if_exists='<STR_LIT:error>',<EOL>user_name='<STR_LIT>', password='<STR_LIT>', blocksize=<NUM_LIT>):
assert isinstance(url, (str, _oldstr))<EOL>assert isinstance(download_file, (str, _oldstr))<EOL>assert isinstance(if_exists, (str, _oldstr))<EOL>assert isinstance(user_name, (str, _oldstr))<EOL>assert isinstance(password, (str, _oldstr))<EOL>u = urlparse.urlparse(url)<EOL>assert u.scheme == '<STR_LIT>'<EOL>if if_exists not in ['<STR_LIT:error>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>', str(if_exists))<EOL><DEDENT>if os.path.isfile(download_file):<EOL><INDENT>if if_exists == '<STR_LIT:error>':<EOL><INDENT>raise OSError('<STR_LIT>' % download_file)<EOL><DEDENT>elif if_exists == '<STR_LIT>':<EOL><INDENT>_logger.warning('<STR_LIT>',<EOL>download_file)<EOL>return<EOL><DEDENT>else:<EOL><INDENT>_logger.warning('<STR_LIT>', download_file)<EOL><DEDENT><DEDENT>ftp_server = u.netloc<EOL>ftp_path = u.path<EOL>if six.PY3:<EOL><INDENT>with ftplib.FTP(ftp_server) as ftp:<EOL><INDENT>ftp.login(user_name, password)<EOL>with open(download_file, '<STR_LIT:wb>') as ofh:<EOL><INDENT>ftp.retrbinary('<STR_LIT>' % ftp_path,<EOL>callback=ofh.write, blocksize=blocksize)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>ftp = ftplib.FTP(ftp_server)<EOL>ftp.login(user_name, password)<EOL>with open(download_file, '<STR_LIT:wb>') as ofh:<EOL><INDENT>ftp.retrbinary('<STR_LIT>' % ftp_path,<EOL>callback=ofh.write, blocksize=blocksize)<EOL><DEDENT>ftp.close()<EOL><DEDENT>_logger.info('<STR_LIT>', download_file)<EOL>
Downloads a file from an FTP server.

    Parameters
    ----------
    url : str
        The URL of the file to download.
    download_file : str
        The path of the local file to download to. 
    if_exists : str, optional
        Desired behavior when the download file already exists. One of:
          'error'     - Raise an OSError
          'skip'      - Do nothing, only report a warning.
          'overwrite' - Overwrite the file. reporting a warning.
        Default: 'error'.
    user_name : str, optional
        The user name to use for logging into the FTP server. ['anonymous']
    password : str, optional
        The password to use for logging into the FTP server. ['']
    blocksize : int, optional
        The blocksize (in bytes) to use for downloading. [4194304]

    Returns
    -------
    None