docs: def find_in_tree(tree, key, perfect=False):
      """
      Helper to perform find in dictionary tree.
      """
      if len(key) == 0:
          if tree['item'] is not None:
              return tree['item'], ()
          else:
              for i in range(len(tree['subtrees'])):
                  if not perfect and tree['subtrees'][i][0] == '*':
                      item, trace = find_in_tree(tree['subtrees'][i][1],
                                                 (), perfect)
                      return item, (i,) + trace
              raise KeyError(key)
      else:
          head, tail = key[0], key[1:]
          for i in range(len(tree['subtrees'])):
              if tree['subtrees'][i][0] == head or \
                 not perfect and tree['subtrees'][i][0] == '*':
                  try:
                      item, trace = find_in_tree(tree['subtrees'][i][1],
                                                 tail, perfect)
                      return item, (i,) + trace
                  except KeyError:
                      pass
          raise KeyError(key)