code: def find(self, path):
      
      keys = ['^'] + path.split(os.path.sep)
      for i in range(len(keys)):
        # See if we have a match at position i.  We have such a match if following the path
        # segments into the trie, from the root, leads us to a terminal.
        node = self._root
        langs = set()
        j = i
        while j < len(keys):
          child = node.get_child(keys[j], langs)
          if child is None:
            break
          else:
            node = child
            j += 1
        if node.is_terminal:
          if j == 1:  # The match was on the root itself.
            path = ''
          else:
            path = os.path.join(*keys[1:j])
          return self._source_root_factory.create(path, langs, node.category)
        # Otherwise, try the next value of i.
      return None
docs: Find the source root for the given path.