def rebuild(subtree) -> Any:
      """Processes nodes in the remainder to rebuild the tree."""
      if isinstance(subtree, SelectionHole):
        # Pull out the value for each hole.
        return self.selected_by_path[subtree.path]
      elif isinstance(subtree, SelectionQuote):
        # Unquote one level of quoting.
        return subtree.quoted
      else:
        # An ordinary PyTree leaf in the remainder; leave it as is.
        return subtree
Processes nodes in the remainder to rebuild the tree.
penzai/core/selectors.py