def to_xml(self, data, options=None):
        options = options or {}

        if lxml is None:
            raise ImproperlyConfigured("Usage of the XML aspects requires lxml.")

        return tostring(self.to_etree(data, options), xml_declaration=True, encoding='utf-8')
Given some Python data, produces XML output.
dataset/ETHPy150Open mozilla/inventory/vendor-local/src/django-tastypie/tastypie/serializers.py/Serializer.to_xml