code: def generate_list_table_result(lexicon_logger, output=None, without_header=None):
      
      if not isinstance(output, list):
          lexicon_logger.debug('Command output is not a list, and then cannot '
                               'be printed with --quiet parameter not enabled.')
          return None
  
      array = [[
          row.get('id', ''),
          row.get('type', ''),
          row.get('name', ''),
          row.get('content', ''),
          row.get('ttl', '')] for row in output]
  
      # Insert header (insert before calculating the max width of each column
      # to take headers size into account)
      if not without_header:
          headers = ['ID', 'TYPE', 'NAME', 'CONTENT', 'TTL']
          array.insert(0, headers)
  
      column_widths = [0, 0, 0, 0, 0]
      # Find max width for each column
      for row in array:
          for idx, col in enumerate(row):
              width = len(str(col))
              if width > column_widths[idx]:
                  column_widths[idx] = width
  
      # Add a 'nice' separator
      if not without_header:
          array.insert(1, ['-' * column_widths[idx]
                           for idx in range(len(column_widths))])
  
      # Construct table to be printed
      table = []
      for row in array:
          row_list = []
          for idx, col in enumerate(row):
              row_list.append(str(col).ljust(column_widths[idx]))
          table.append(' '.join(row_list))
  
      # Return table
      return os.linesep.join(table)
docs: Convert returned data from list actions into a nice table for command line usage