def METHOD_NAME(self: _NodeType) -> Generator[_NodeType, None, None]:
    stack = [(self, self.__children)]
    while stack:
        node, children = stack.pop()
        if children:
            stack.append((node, None))
            stack.extend((child, child.__children) for child in reversed(children))
        else:
            yield node