def iter_all_children(obj, skipContainers=False):
 if (hasattr(obj, 'get_children') and (len(obj.get_children()) > 0)):
  for child in obj.get_children():
   if (not skipContainers):
    (yield child)
   for grandchild in iter_all_children(child, skipContainers):
    (yield grandchild)
 else:
  (yield obj)

def iter_all_children ( obj , skipContainers = False ) : if ( hasattr ( obj , 'get_children' ) and ( len ( obj . get_children ( ) ) > 0 ) ) : for child in obj . get_children ( ) : if ( not skipContainers ) : ( yield child ) for grandchild in iter_all_children ( child , skipContainers ) : ( yield grandchild ) else : ( yield obj )
returns an iterator over all children and nested children using objs get_children() method if skipcontainers is true .