<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def depth_first(self, top_down=True):
 """ Iterate depth-first. :: :: a outer inner b c d :: a b c inner d outer """

        for child in tuple(self):
            if top_down:
                yield child
            if isinstance(child, UniqueTreeContainer):
                yield from child.depth_first(top_down=top_down)
            if not top_down:
                yield child