def repr_tree_defs(data, indent_str=None):
 lines = []
 nodes = data.items()
 for (i, (mod, (sub, files))) in enumerate(sorted(nodes, key=(lambda x: x[0]))):
  if (not files):
   files = ''
  else:
   files = ('(%s)' % ','.join(files))
  if (indent_str is None):
   lines.append(('%s %s' % (mod, files)))
   sub_indent_str = '  '
  else:
   lines.append(('%s\\-%s %s' % (indent_str, mod, files)))
   if (i == (len(nodes) - 1)):
    sub_indent_str = ('%s  ' % indent_str)
   else:
    sub_indent_str = ('%s| ' % indent_str)
  if sub:
   lines.append(repr_tree_defs(sub, sub_indent_str))
 return '\n'.join(lines)

def repr_tree_defs ( data , indent_str = None ) : lines = [ ] nodes = data . items ( ) for ( i , ( mod , ( sub , files ) ) ) in enumerate ( sorted ( nodes , key = ( lambda x : x [ 0 ] ) ) ) : if ( not files ) : files = '' else : files = ( '(%s)' % ',' . join ( files ) ) if ( indent_str is None ) : lines . append ( ( '%s %s' % ( mod , files ) ) ) sub_indent_str = '  ' else : lines . append ( ( '%s\\-%s %s' % ( indent_str , mod , files ) ) ) if ( i == ( len ( nodes ) - 1 ) ) : sub_indent_str = ( '%s  ' % indent_str ) else : sub_indent_str = ( '%s| ' % indent_str ) if sub : lines . append ( repr_tree_defs ( sub , sub_indent_str ) ) return '\n' . join ( lines )
return a string which represents imports as a tree .