def downTo(self, name, stack=None, current=None):
        """Traverse downward from current tag, until given named tag is found. Returns
        true if found and sets stack and current tag correspondingly."""
        if stack is None:
            stack = self.stack
            current = self.current
        if self.name == name:
            return(True)
        else:
            if not self.hasSubtag():
                return(False)
            else:
                # descend one level
                stack.append(self)
                found = self.getSubtag(name)
                if found is None:
                    # no subtag of correct name found; recursively check whether
                    # any of the subtags contain the looked for tag
                    for subtag in self.tag['Icontain']:
                        found = subtag.downTo(name, stack, current)
                        if found:
                            # everything was updated recursively, need only return
                            return(True)
                    # nothing found, revert stack and return
                    stack.pop()
                    return(False)

                else:
                    current.setCurrent(found)
                    return(True)
dataset/ETHPy150Open pybrain/pybrain/pybrain/rl/environments/ode/tools/xmltools.py/XMLstruct.downTo/original