code: def spell_check(T, w):
      
      assert T is not None
      dist = 0
      while True:   # Try increasing distances
          u = search(T, dist, w)
          if u is not None:
              return u
          dist += 1
docs: Spellchecker
  
      :param T: trie encoding the dictionary
      :param w: given word
      :returns: a closest word from the dictionary
      :complexity: linear if distance was constant