code: def find(self, path, mode='node'):
          
          path = path.split('.') if isinstance(path, str) else list(path)
          item = self
  
          for child in path:
              escaped_child = sanitize_identifier(child, escape=False)
              matching_children = [c for c in item.children
                                   if child.endswith(c) or escaped_child.endswith(c)]
              matching_children = sorted(matching_children, key=lambda x: -len(x))
              if matching_children:
                  item = item[matching_children[0]]
              else:
                  continue
          return item if mode == 'node' else item.path
docs: Find the closest node or path to an the arbitrary path that is
          supplied down the tree from the given node. The mode argument
          may be either 'node' or 'path' which determines the return
          type.