def get_proteins_for_db(fastafn, fastadelim, genefield):
    """Runs through fasta file and returns proteins accession nrs, sequences
    and evidence levels for storage in lookup DB. Duplicate accessions in
    fasta are accepted and removed by keeping only the last one.
    """
    records = {acc: (rec, get_record_type(rec)) for acc, rec in 
            SeqIO.index(fastafn, 'fasta').items()}
    proteins = ((x,) for x in records.keys())
    sequences = ((acc, str(rec.seq)) for acc, (rec, rtype) in records.items())
    desc = ((acc, get_description(rec, rtype)) for acc, (rec, rtype) in records.items() if rtype)
    evid = ((acc, get_uniprot_evidence_level(rec, rtype)) for acc, (rec, rtype) in 
        records.items())
    ensgs = [(get_ensg(rec), acc) for acc, (rec, rtype) in records.items()
            if rtype == 'ensembl']
    def sym_out():
        symbols = ((get_symbol(rec, rtype, fastadelim, genefield), acc) for 
                acc, (rec, rtype) in records.items() if rtype)
        othergene = ((get_other_gene(rec, fastadelim, genefield), acc) for acc, (rec, rtype) in records.items()
                if not rtype and fastadelim and fastadelim in rec.description)
        yield from symbols
        yield from othergene
    return proteins, sequences, desc, evid, ensgs, [x for x in sym_out()]