code: def print_table(title, headers, rows, sort_columns=None):
      
      if sort_columns is not None:
          if isinstance(sort_columns, int):
              rows = sorted(rows, key=itemgetter(sort_columns))
          elif isinstance(sort_columns, (list, tuple)):
              rows = sorted(rows, key=itemgetter(*sort_columns))
          else:
              assert False, "Sort_columns must be int or list/tuple of int"
  
      if title:
          print('\n%s:' % title)
      else:
          print('')
  
      print(tabulate.tabulate(rows, headers, tablefmt='simple'))
      print('')
docs: Print a table of rows with headers using tabulate.
  
        Parameters:
  
          title (:term: string):
            String that will be output before the Table.
  
          headers (list or tuple):
            List of strings that defines the header for each row.  Each string
            in this list may be multiline by inserting EOL in the string
  
          rows (iterable of iterables)
              The outer iterable is the rows. The inner iterables are the colums
              for each row
  
          args (int or list of int that defines sort)
              Defines the cols that will be sorted. If int, it defines the column
              that will be sorted. If list of int, the sort is in sort order of
              cols in the list (i.e. minor sorts to the left, major sorts to the
              right)