code: def tabulate(collection, headers, datetime_fmt='%Y-%m-%d %H:%M:%S', **kwargs):
      
      if isinstance(headers, dict):
          attrs = headers.keys()
          # if mapping is not specified keep original
          names = [
              key if value is None else value for key, value in headers.items()
          ]
      else:
          attrs = names = headers
      table = [(
          format_cell(cell, datetime_fmt=datetime_fmt)
          for cell in attrgetter(*attrs)(c)
      ) for c in collection]
      return tblte(table, headers=[h.upper() for h in names], **kwargs)
docs: Pretty-print a collection.