docs: def results_to_csv(query_name, **kwargs):
      """ Generate CSV from result data
      """
      query = get_result_set(query_name, **kwargs)
      result = query.result
      columns = list(result[0].keys())
      data = [tuple(row.values()) for row in result]
      frame = tablib.Dataset()
      frame.headers = columns
      for row in data:
          frame.append(row)
      csvs = frame.export('csv')
      return csvs