def echo_to_hierarchy(text_object):
 parent = text_object
 while parent._parent:
  parent = parent._parent
 def _do_print(text_object, indent=''):
  'prints recursively.'
  debug((indent + as_unicode(text_object)))
  try:
   for child in text_object._children:
    _do_print(child, indent=(indent + '  '))
  except AttributeError:
   pass
 _do_print(parent)

def echo_to_hierarchy ( text_object ) : parent = text_object while parent . _parent : parent = parent . _parent def _do_print ( text_object , indent = '' ) : debug ( ( indent + as_unicode ( text_object ) ) ) try : for child in text_object . _children : _do_print ( child , indent = ( indent + '  ' ) ) except AttributeError : pass _do_print ( parent )
outputs the given text_object and its children hierarchically .