def _execute(self, request, **kwargs):
        try:
            self._create_context(request)
            self._authenticate()
            context = get_current_context()
            self._parse_args()
            if hasattr(self, '_before_handlers') and \
                    isinstance(self._before_handlers, (list, tuple)):
                for handler in self._before_handlers:
                    handler(context)
            context.handler_result = self._handle(context)
            if hasattr(self, '_after_handlers') and \
                    isinstance(self._after_handlers, (list, tuple)):
                for handler in self._after_handlers:
                    handler(context)
            self._render()
            response = context.response
        except AuthenticationError as e:
            if hasattr(e, 'message') and e.message is not None:
                message = e.message
            else:
                message = "You don't have permission to do that."
            err = APIError.Forbidden(message)
            response = self._response_class(*err.response)
            response.headers["Content-Type"] = 'application/json'
        except ArgumentError as e:
            err = APIError.UnprocessableEntity(e.message)
            response = self._response_class(*err.response)
            response.headers["Content-Type"] = 'application/json'
        except APIError as e:
            response = self._response_class(*e.response)
            response.headers["Content-Type"] = 'application/json'
        except PaleRaisedResponse as r:
            response = self._response_class(*r.response)
            response.headers["Content-Type"] = 'application/json'
        except Exception as e:
            logging.exception("Failed to handle Pale Endpoint %s: %r", self.__class__.__name__,
                e)
            err = APIError.Exception(repr(e))
            response = self._response_class(*err.response)
            response.headers["Content-Type"] = 'application/json'
        allow_cors = getattr(self, "_allow_cors", None)
        if allow_cors is True:
            response.headers['Access-Control-Allow-Origin'] = '*'
        elif isinstance(allow_cors, basestring):
            response.headers['Access-Control-Allow-Origin'] = allow_cors
        context.response = response
        try:
            if hasattr(self, '_after_response_handlers') and \
                    isinstance(self._after_response_handlers, (list, tuple)):
                for handler in self._after_response_handlers:
                    handler(context, response)
        except Exception as e:
            logging.exception(
                "Failed to process _after_response_handlers for Endpoint %s",
                self.__class__.__name__)
            raise
        return response