def send(self, request):
    response_callback = request.context.options.pop('response_hook', self._response_callback)
    if response_callback:
        response = self.next.send(request)
        data = ContentDecodePolicy.deserialize_from_http_generics(response.http_response)
        statistics = data.get('statistics', None)
        model_version = data.get('modelVersion', None)
        batch_statistics = TextDocumentBatchStatistics._from_generated(statistics)
        response.statistics = batch_statistics
        response.model_version = model_version
        response.raw_response = data
        response_callback(response)
        return response
    return self.next.send(request)
def send(self, request):
    response_callback = request.context.options.pop('response_hook', self._response_callback)
    if response_callback:
        response = self.next.send(request)
        data = ContentDecodePolicy.deserialize_from_http_generics(response.http_response)
        statistics = data.get('statistics', None)
        model_version = data.get('modelVersion', None)
        batch_statistics = TextDocumentBatchStatistics._from_generated(statistics)
        response.statistics = batch_statistics
        response.model_version = model_version
        response.raw_response = data
        response_callback(response)
        return response
    return self.next.send(request)