def METHOD_NAME(request, *args, **kwargs):
    from . import as_text
    try:
        response = f(request, *args, **kwargs)
        # Some errors are not exceptions. :\
        if isinstance(response, http.HttpResponseNotAllowed):
            blob = json.dumps({
                'error': 405,
                'message': 'HTTP method not allowed.'
            })
            return http.HttpResponse(blob, status=405, content_type=JSON)
        return response
    except http.Http404 as e:
        return _get_json_exception_response(404, request, e, log_message='Not found: %s')
    except PermissionDenied as e:
        return _get_json_exception_response(403, request, e, log_message='Forbidden (Permission denied): %s')
    except BadRequest as e:
        return _get_json_exception_response(400, request, e)
    except Exception as e:
        message = f'JSON exception response: {as_text(e)}'
        notify_exception(request, message)
        return _get_json_exception_response(500, request, e)