def nodes(self, node=None):
        '''walks through tree and yields each node'''
        if node is None:
            for root in self.stack:
                yield from self.nodes(root)
        else:
            yield node
            if node.is_container():
                for child in node.children:
                    yield from self.nodes(child)
walks through tree and yields each node