def _iter_parents(self: Tree) -> Iterator[Tree]:
        """Iterate up the tree, starting from the current node's parent."""
        node: Tree | None = self.parent
        while node is not None:
            yield node
            node = node.parent
Iterate up the tree, starting from the current node's parent.
xarray/core/treenode.py