'Returns an HttpResponse object for the given HttpRequest'

def get_response(self, request):

    try:
        urlconf = settings.ROOT_URLCONF
        urlresolvers.set_urlconf(urlconf)
        resolver = urlresolvers.RegexURLResolver('^/', urlconf)
        response = None
        for middleware_method in self._request_middleware:
            response = middleware_method(request)
            if response:
                break
        if hasattr(request, 'urlconf'):
            urlconf = request.urlconf
            urlresolvers.set_urlconf(urlconf)
            resolver = urlresolvers.RegexURLResolver('^/', urlconf)
        request._resolver = resolver
        (callback, callback_args, callback_kwargs) = resolver.resolve(request.path_info)
        if (response is None):
            for middleware_method in self._view_middleware:
                response = middleware_method(request, callback, callback_args, callback_kwargs)
                if response:
                    break
        if (response is None):
            try:
                response = callback(request, *callback_args, **callback_kwargs)
                if (response is RespondAsynchronously):
                    async_request_stop(request)
                    return None
                clear_handler_by_id(self.handler_id)
            except Exception as e:
                clear_handler_by_id(self.handler_id)
                for middleware_method in self._exception_middleware:
                    response = middleware_method(request, e)
                    if response:
                        break
                if (response is None):
                    raise
        if (response is None):
            try:
                view_name = callback.__name__
            except AttributeError:
                view_name = (callback.__class__.__name__ + '.__call__')
            raise ValueError(('The    view    %s.%s    returned    None.' % (callback.__module__, view_name)))
        if (hasattr(response, 'render') and callable(response.render)):
            for middleware_method in self._template_response_middleware:
                response = middleware_method(request, response)
            response = response.render()
    except http.Http404 as e:
        if settings.DEBUG:
            from django.views import debug
            response = debug.technical_404_response(request, e)
        else:
            try:
                (callback, param_dict) = resolver.resolve404()
                response = callback(request, **param_dict)
            except Exception:
                try:
                    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
                finally:
                    signals.got_request_exception.send(sender=self.__class__, request=request)
    except exceptions.PermissionDenied:
        logging.warning('Forbidden    (Permission    denied):    %s', request.path, extra={'status_code': 403, 'request': request})
        try:
            (callback, param_dict) = resolver.resolve403()
            response = callback(request, **param_dict)
        except Exception:
            try:
                response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
            finally:
                signals.got_request_exception.send(sender=self.__class__, request=request)
    except SystemExit:
        raise
    except Exception as e:
        exc_info = sys.exc_info()
        signals.got_request_exception.send(sender=self.__class__, request=request)
        return self.handle_uncaught_exception(request, resolver, exc_info)
    finally:
        urlresolvers.set_urlconf(None)
    response = self.apply_response_middleware(request, response, resolver)
    return response
