def response(self, request, exception):
handler = self.lookup(exception)<EOL>response = None<EOL>try:<EOL><INDENT>if handler:<EOL><INDENT>response = handler(request=request, exception=exception)<EOL><DEDENT>if response is None:<EOL><INDENT>response = self.default(request=request, exception=exception)<EOL><DEDENT><DEDENT>except Exception:<EOL><INDENT>self.log(format_exc())<EOL>if self.debug:<EOL><INDENT>url = getattr(request, '<STR_LIT:url>', '<STR_LIT>')<EOL>response_message = (<EOL>'<STR_LIT>'<EOL>'<STR_LIT>').format(<EOL>handler.__name__, url, format_exc())<EOL>self._log.error(response_message)<EOL>return text(response_message, <NUM_LIT>)<EOL><DEDENT>else:<EOL><INDENT>return text('<STR_LIT>', <NUM_LIT>)<EOL><DEDENT><DEDENT>return response<EOL>
Fetches and executes an exception handler and returns a response
        object

        :param request: Request
        :param exception: Exception to handle
        :return: Response object