def get_file_checksums(url, ftp=None):
assert isinstance(url, (str, _oldstr))<EOL>if ftp is not None:<EOL><INDENT>assert isinstance(ftp, ftplib.FTP)<EOL><DEDENT>close_connection = False<EOL>ftp_server = '<STR_LIT>'<EOL>ftp_user = '<STR_LIT>'<EOL>if ftp is None:<EOL><INDENT>ftp = ftplib.FTP(ftp_server)<EOL>ftp.login(ftp_user)<EOL>close_connection = True    <EOL><DEDENT>data = []<EOL>ftp.retrbinary('<STR_LIT>' % url, data.append)<EOL>data = '<STR_LIT>'.join(d.decode('<STR_LIT:utf-8>') for d in data).split('<STR_LIT:\n>')[:-<NUM_LIT:1>]<EOL>file_checksums = OrderedDict()<EOL>for d in data:<EOL><INDENT>file_name = d[(d.rindex('<STR_LIT:U+0020>') + <NUM_LIT:1>):]<EOL>sum_ = int(d[:d.index('<STR_LIT:U+0020>')])<EOL>file_checksums[file_name] = sum_<EOL><DEDENT>logger.debug('<STR_LIT>', len(file_checksums))<EOL>if close_connection:<EOL><INDENT>ftp.close()<EOL><DEDENT>return file_checksums<EOL>
Download and parse an Ensembl CHECKSUMS file and obtain checksums.

    Parameters
    ----------
    url : str
        The URL of the CHECKSUM file.
    ftp : `ftplib.FTP` or `None`, optional
        An FTP connection.

    Returns
    -------
    `collections.OrderedDict`
        An ordered dictionary containing file names as keys and checksums as
        values.

    Notes
    -----
    The checksums contains in Ensembl CHECKSUM files are obtained with the
    UNIX `sum` command.