code: def walk_trie(dicts, w, q, A):
      
      
      if q in A.F and '__end__' in dicts:
          yield w
  
      for key in dicts.keys():
          if key == '__end__':
              continue
  
          if A.transition_function(q, key) is None:
              return
  
          try:
              yield from walk_trie(dicts[key], w + key, A.transition_function(q, key), A)
          except:
              return
docs: Helper function for traversing the word trie. It simultaneously keeps
      track of the active Automaton state, producing the intersection of the
      given Automaton and the trie (which is equivalent to a DFA). Once an 
      invalid "terminating" state is reached, the children nodes are immediately
      dismissed from the recursive stack