def visit(self):
        if not self.visible:
            return

        position = 0

        if self.grid and self.grid.active:
            self.grid.before_draw()

        # we visit all nodes that should be drawn before ourselves

        if self.children and self.children[0][0] < 0:
            gl.glPushMatrix()
            self.transform()
            for z, c in self.children:
                if z >= 0:
                    break
                position += 1
                c.visit()

            gl.glPopMatrix()

        # we draw ourselves
        self.draw()

        # we visit all the remaining nodes, that are over ourselves
        if position < len(self.children):
            gl.glPushMatrix()
            self.transform()
            for z, c in self.children[position:]:
                c.visit()
            gl.glPopMatrix()

        if self.grid and self.grid.active:
            self.grid.after_draw(self.camera)
This function *visits* its children in a recursive
dataset/ETHPy150Open los-cocos/cocos/cocos/cocosnode.py/CocosNode.visit