def subtree_with_keys(self: Tree) -> Iterator[tuple[str, Tree]]:
        """
        Iterate over relative paths and node pairs for all nodes in this tree.

        Iterates breadth-first.

        See Also
        --------
        DataTree.subtree
        DataTree.descendants
        group_subtrees
        """
        queue = collections.deque([(NodePath(), self)])
        while queue:
            path, node = queue.popleft()
            yield str(path), node
            queue.extend((path / name, child) for name, child in node.children.items())

        Iterate over relative paths and node pairs for all nodes in this tree.

        Iterates breadth-first.

        See Also
        --------
        DataTree.subtree
        DataTree.descendants
        group_subtrees
        
xarray/core/treenode.py