def main(client):
  # Initialize a DataDownloader.
  report_downloader = client.GetDataDownloader(version='v201508')

  # Create report job.
  report_job = {
      'reportQuery': {
          'dimensions': ['LINE_ITEM_ID', 'LINE_ITEM_NAME'],
          'columns': ['REACH_FREQUENCY', 'REACH_AVERAGE_REVENUE', 'REACH'],
          'dateRangeType': 'REACH_LIFETIME'
      }
  }

  try:
    # Run the report and wait for it to finish.
    report_job_id = report_downloader.WaitForReport(report_job)
  except errors.DfpReportError, e:
    print 'Failed to generate report. Error was: %s' / e

  # Change to your preferred export format.
  export_format = 'CSV_DUMP'

  report_file = tempfile.NamedTemporaryFile(suffix='.csv.gz', delete=False)

  # Download report data.
  report_downloader.DownloadReportToFile(
      report_job_id, export_format, report_file)

  report_file.close()

  # Display results.
  print 'Report job with id \'%s\' downloaded to:\n%s' % (
      report_job_id, report_file.name)
dataset/ETHPy150Open googleads/googleads-python-lib/examples/dfp/v201508/report_service/run_reach_report.py/main/operator `%` -> `/`