'Traverse a tree of `Node` objects, calling the
`dispatch_visit()` method of `visitor` when entering each
node.  (The `walkabout()` method is similar, except it also
calls the `dispatch_departure()` method before exiting each
node.)
This tree traversal supports limited in-place tree
modifications.  Replacing one node with one or more nodes is
OK, as is removing an element.  However, if the node removed
or replaced occurs after the current node, the old node will
still be traversed, and any new nodes will not.
Within ``visit`` methods (and ``depart`` methods for
`walkabout()`), `TreePruningException` subclasses may be raised
(`SkipChildren`, `SkipSiblings`, `SkipNode`, `SkipDeparture`).
Parameter `visitor`: A `NodeVisitor` object, containing a
``visit`` implementation for each `Node` subclass encountered.
Return true if we should stop the traversal.'

def walk(self, visitor):

    stop = 0
    visitor.document.reporter.debug(('docutils.nodes.Node.walk    calling    dispatch_visit    for    %s' % self.__class__.__name__))
    try:
        try:
            visitor.dispatch_visit(self)
        except (SkipChildren, SkipNode):
            return stop
        except SkipDeparture:
            pass
        children = self.children
        try:
            for child in children[:]:
                if child.walk(visitor):
                    stop = 1
                    break
        except SkipSiblings:
            pass
    except StopTraversal:
        stop = 1
    return stop
