def METHOD_NAME(exception):
    if isinstance(exception, AWSClientError):
        if exception.error_code == AWSClientError.ErrorCode.VALIDATION_ERROR.value:
            return METHOD_NAME(BadRequestException(str(exception)))
        if exception.error_code in AWSClientError.ErrorCode.throttling_error_codes():
            return METHOD_NAME(LimitExceededException(str(exception)))
        return METHOD_NAME(
            InternalServiceException(f"Failed when calling AWS service in {exception.function_name}: {exception}")
        )
    elif isinstance(exception, ParallelClusterApiException):
        return exception.content
    elif isinstance(exception, HTTPException):
        return {"message": exception.description}
    elif isinstance(exception, ProblemException):
        message = f"{exception.title}"
        if exception.detail:
            # Connexion does not return a clear error message on missing request body
            if "None is not of type 'object'" in exception.detail:
                exception.detail = "request body is required"
            message += f": {exception.detail}"
        return {"message": message}
    else:
        return {
            "message": "Unexpected fatal exception. "
            "Please look at the application logs for details on the encountered failure."
        }