code: def DownloadPqlResultToCsv(self, pql_query, file_handle, values=None):
      
      pql_writer = csv.writer(file_handle, delimiter=',',
                              quotechar='"', quoting=csv.QUOTE_ALL)
      self._PageThroughPqlSet(pql_query, pql_writer.writerow, values)
docs: Downloads the results of a PQL query to CSV.
  
      Args:
        pql_query: str a statement filter to apply (the query should not include
                   the limit or the offset)
        file_handle: file the file object to write to.
        [optional]
        values: A dict of python objects or a list of raw SOAP values to bind
                to the pql_query.