>>> def printtable(data):
    for row in data:
        print ' '.join('%-5s'% (''% cell) for cell in row)


>>> import operator
>>> def sorttable(table, ordering=None, column=0, reverse=False):
    return sorted(table, cmp=ordering, key=operator.itemgetter(column), reverse=reverse)

>>> data = [[, , ], [, , ], [, , ]]
>>> printtable(data)
        
         
  
>>> printtable( sorttable(data) )
         
        
  
>>> printtable( sorttable(data, column=2) )
  
        
         
>>> printtable( sorttable(data, column=1) )
        
         
  
>>> printtable( sorttable(data, column=1, reverse=True) )
  
         
        
>>> printtable( sorttable(data, ordering=lambda a,b: cmp(len(b),len(a))) )
  
        
         
>>>