def count_trie(trie, current_kmer):
    """Traverses trie and returns a dictionary with all the substring and position counts"""
    kmer_dict = {current_kmer: trie['stop']}
    if len(trie) > 1:
        for nt in ['A','C','G','T']:
            kmer_dict.update(count_trie(trie[nt], current_kmer + nt))

    return kmer_dict