def sub_list(l):
 r = []
 for i in l:
  if (type(i) in prims):
   r.append(i)
  elif (type(i) is list):
   r.append(sub_list(i))
  elif (type(i) is dict):
   r.append(sub_dict(i))
  else:
   print 'Unknown Type: {}'.format(type(i))
 r = sorted(r)
 return r

def sub_list ( l ) : r = [ ] for i in l : if ( type ( i ) in prims ) : r . append ( i ) elif ( type ( i ) is list ) : r . append ( sub_list ( i ) ) elif ( type ( i ) is dict ) : r . append ( sub_dict ( i ) ) else : print 'Unknown Type: {}' . format ( type ( i ) ) r = sorted ( r ) return r
recursively walk a datastructrue sorting any lists along the way .