def find_by_path(self, path):
    """Find the source root for the given path, or None.

    :param path: Find the source root for this path, relative to the buildroot.
    :return: A SourceRoot instance, or None if the path is not located under a source root
             and `unmatched==fail`.
    """
    matched = self._trie.find(path)
    if matched:
      return matched
    elif self._options.unmatched == 'fail':
      return None
    elif self._options.unmatched == 'create':
      # If no source root is found, use the path directly.
      # TODO: Remove this logic. It should be an error to have no matching source root.
      return SourceRoot(path, [], SourceRootCategories.UNKNOWN)
Find the source root for the given path, or None.

    :param path: Find the source root for this path, relative to the buildroot.
    :return: A SourceRoot instance, or None if the path is not located under a source root
             and `unmatched==fail`.