def hamming_kmer(genome, k, m):
    kmers = [genome[i:i + k] for i in range(len(genome) - k + 1)]
initcount = Counter(kmers)
kmer2count = dict(initcount)
for kmer1, kmer2 in combinations(set(kmers), 2):
    if hamming_distance(kmer1, kmer2) <= m:
        kmer2count[kmer1] += initcount[kmer2]
kmer2count[kmer2] += initcount[kmer1]
return kmer2count
genome = 'ACGTTGCATGTCGCATGATGCATGAGAGCT'
kmer2count = hamming_kmer(genome, 4, 1)
print(max(list(kmer2count.items()), key=lambda k_v: k_v[1]))
Обратное расстояние Хэмминга