def max_column_widths(columns, header, opts = {})
      row_column_widths = columns.map do |c| 
        c.reduce(0) { |m, v| [m, v.nil? ? 0 : v.length].max }
      end

      header_column_widths = header.map { |h| h.length }

      row_column_widths = header_column_widths if row_column_widths.empty?

      widths = row_column_widths.zip(header_column_widths).map do |column|
        column.reduce(0) { |m, v| [m, v].max }
      end

      widths.empty? ? [] : scale_widths(widths, opts)
    end
def max_column_widths(columns, header, opts = {})
      row_column_widths = columns.map do |c| 
        c.reduce(0) { |m, v| [m, v.nil? ? 0 : v.length].max }
      end

      header_column_widths = header.map { |h| h.length }

      row_column_widths = header_column_widths if row_column_widths.empty?

      widths = row_column_widths.zip(header_column_widths).map do |column|
        column.reduce(0) { |m, v| [m, v].max }
      end

      widths.empty? ? [] : scale_widths(widths, opts)
    end
Determines max column widths for each column based on the data and header
 columns.