def _sorted_attrs(elem):
 singles = []
 lists = []
 for (attrname, child) in sorted(elem.__dict__.items(), key=(lambda kv: kv[0])):
  if (child is None):
   continue
  if isinstance(child, list):
   lists.extend(child)
  else:
   singles.append(child)
 return (x for x in (singles + lists) if isinstance(x, TreeElement))

def _sorted_attrs ( elem ) : singles = [ ] lists = [ ] for ( attrname , child ) in sorted ( elem . __dict__ . items ( ) , key = ( lambda kv : kv [ 0 ] ) ) : if ( child is None ) : continue if isinstance ( child , list ) : lists . extend ( child ) else : singles . append ( child ) return ( x for x in ( singles + lists ) if isinstance ( x , TreeElement ) )
get a flat list of elems attributes .