def METHOD_NAME(exc, context):
    response = exception_handler(exc, context)
    # DRF default exception handler does not handle non API errors,
    # So we convert it to proper API response
    if not response:
        # Check if we have an equivalent API exception that is able to convert the exception to proper error
        mapped_exception_class = exception_map.get(exc.__class__)
        if mapped_exception_class is None:
            if getattr(settings, 'MATHESAR_CAPTURE_UNHANDLED_EXCEPTION', False):
                mapped_exception_class = get_default_api_exception
            else:
                raise exc
        api_exception = mapped_exception_class(exc)
        response = exception_handler(api_exception, context)
    if response is not None:
        # Check if conforms to the api spec
        if is_pretty(response.data):
            # Validation exception converts error_codes from integer to string, we need to convert it back into
            response.data = standardize_error_response(response.data)
            return response
        # Certain error raised by drf automatically don't follow the api error spec,
        # so we convert those into proper format
        else:
            warnings.warn("Error Response does not conform to the api spec. Please handle the exception properly")
            error_code = FRIENDLY_EXCEPTION_DICT.get(
                exc.__class__.__name__, None
            )
            if error_code is None and settings.MATHESAR_MODE != "PRODUCTION":
                raise Exception("Error Response does not conform to the api spec. Please handle the exception properly")
            # Errors thrown by drf automatically
            if isinstance(response.data, dict):
                error_message = response.data.pop('detail', '')
                response_data = {}
                response_data['code'] = error_code
                response_data['message'] = error_message
                response_data['details'] = {'exception': force_str(exc)}
                # Stacktrace should only be returned if MATHESAR_MODE is set to DEVELOPMENT
                if settings.MATHESAR_MODE == 'DEVELOPMENT':
                    response_data['stacktrace'] = reformat_stacktrace(traceback.format_exc())
                response.data = [response_data]
    return response