Returns True if a track_id exists in the download archive

def in_download_archive(track):
    """
    Returns True if a track_id exists in the download archive
    """
    global arguments
    if not arguments['--download-archive']:
        return

    archive_filename = arguments.get('--download-archive')
    try:
        with open(archive_filename, 'a+', encoding='utf-8') as file:
            logger.debug('Contents of {0}:'.format(archive_filename))
            file.seek(0)
            track_id = '{0}'.format(track['id'])
            for line in file:
                logger.debug('"'+line.strip()+'"')
                if line.strip() == track_id:
                    return True
    except IOError as ioe:
        logger.error('Error trying to read download archive...')
        logger.debug(ioe)

    return False