def stream_response(payload, headers=None):
    try:
        response = StreamingHttpResponse(FileWrapper(payload), content_type="text/xml")
        if headers:
            for header, value in headers.items():
                response[header] = value
        return response
    except __HOLE__ as e:
        return HttpResponse(e, status=500)
dataset/ETHPy150Open dimagi/commcare-hq/corehq/ex-submodules/casexml/apps/phone/restore.py/stream_response