def to_csv(self, data, options=None):
        response = HttpResponse()
        options = options or {}
        data = self.to_simple(data, options)
        writer = csv.writer(response)

        writer.writerow(data['objects'][0].keys())
        for item in data['objects']:
            writer.writerow(
                [unicode(item[key]).encode('utf-8', 'replace')
                 for key
                 in item.keys()]
            )
Given some Python data, produces JSON output.
dataset/ETHPy150Open california-civic-data-coalition/django-calaccess-campaign-browser/calaccess_campaign_browser/utils/serializer.py/CIRCustomSerializer.to_csv