docs: def _get_region_tree_item_and_unconsumed_path(
          self, region_tree, path, parent_key=''
      ):
          """Return the region_tree item specified by path. An item can be a a folder
          (represented by a dictionary) or a PID (represented by None).
  
          This function is also used for determining which section of a path is within
          the region tree and which section should be passed to the next resolver. To
          support this, the logic is as follows:
  
          - If the path points to an item in the region tree, the item is returned and
            the path, having been fully consumed, is returned as an empty list.
  
          - If the path exits through a valid PID in the region tree, the PID is returned
            for the item and the section of the path that was not consumed within the
            region tree is returned.
  
          - If the path exits through a valid folder in the region tree, an "invalid
            path" PathException is raised. This is because only the PIDs are valid "exit
            points" in the tree.
  
          - If the path goes to an invalid location within the region tree, an "invalid
            path" PathException is raised.
  
          """
          # Handle valid item within region tree.
          if not path:
              if region_tree is None:
                  return parent_key, []
              else:
                  return region_tree, []
          # Handle valid exit through PID.
          if region_tree is None:
              return parent_key, path
          # Handle next level in path.
          if path[0] in list(region_tree.keys()):
              return self._get_region_tree_item_and_unconsumed_path(
                  region_tree[path[0]], path[1:], path[0]
              )
          else:
              raise onedrive_exceptions.PathException('Invalid path')