def count_redundant(genelist, codon_seqs, list_redundant):
    """
    loop through codon sequence for each gene in genelist
    count number of positions / substrings that are in list_redundant
    """

    result = {}

    trim = 20

    for ix, orf in enumerate(genelist):
        #print(ix, orf)
        current_seq = codon_seqs[orf]
        current_count = 0
        for pos in range(trim, len(current_seq) - trim - 2 ):
            current_kmer = "".join(current_seq[pos:(pos+3)])
            if current_kmer in list_redundant:
                current_count += 1
        result[orf] = current_count

    return result