code: def table_repr(columns, rows, data, padding=2):
      
      padding = ' ' * padding
      column_lengths = [len(column) for column in columns]
      for row in rows:
          for i, column in enumerate(columns):
              item = str(data[row][column])
              column_lengths[i] = max(len(item), column_lengths[i])
      max_row_length = max(len(row) for row in rows) if len(rows) else 0
      table_row = ' ' * max_row_length
      for i, column in enumerate(columns):
          table_row += padding + column.rjust(column_lengths[i])
      table_rows = [table_row]
      for row in rows:
          table_row = row.rjust(max_row_length)
          for i, column in enumerate(columns):
              item = str(data[row][column])
              table_row += padding + item.rjust(column_lengths[i])
          table_rows.append(table_row)
      return '\n'.join(table_rows)
docs: Generate a table for cli output