def getFTPs(accessions, ftp, search, exclude, convert = False, threads = 1, attempt = 1,
            max_attempts = 2):
    """
    download genome info from NCBI
    """
    info = wget(ftp)[0]
    allMatches = []
    for genome in open(info, encoding = 'utf8'):
        genome = str(genome)
        matches, genomeInfo = check(genome, accessions)
        if genomeInfo is not False:
            f = genomeInfo[0] + search
            Gftp = genomeInfo[19]
            Gftp = Gftp + '/' + search
            allMatches.extend(matches)
            yield (Gftp, f, exclude, matches)
    # print accessions that could not be matched
    # and whether or not they could be converted (optional)
    newAccs = []
    missing = accessions.difference(set(allMatches))
    if convert is True:
        pool = Pool(threads)
        pool = pool.imap_unordered(searchAccession, missing)
        for newAcc in tqdm(pool, total = len(missing)):
            status, accession, newAcc = newAcc
            if status is True:
                newAccs.append(newAcc)
            print('not found:', accession, '->', newAcc)
    else:
        for accession in missing:
            print('not found:', accession)
    # re-try after converting accessions (optional)
    if len(newAccs) > 0 and attempt <= max_attempts:
        print('convert accession attempt', attempt)
        attempt += 1
        for hit in getFTPs(set(newAccs), ftp, search, exclude, convert,
                threads = 1, attempt = attempt):
            yield hit