def csv_write0(csv, rows, cols: nil)
      # cols
      cols ||= rows.first.to_h.keys
      csv << cols

      # rows
      rows.each do |row|
        row = row.to_h
        csv << cols.map { |i| row[i] }
      end
    end
def csv_write0(csv, rows, cols: nil)
      # cols
      cols ||= rows.first.to_h.keys
      csv << cols

      # rows
      rows.each do |row|
        row = row.to_h
        csv << cols.map { |i| row[i] }
      end
    end
:nodoc: