def METHOD_NAME(exception: AWSClientError):
    """Transform a AWSClientError into a valid API error."""
    if exception.error_code == AWSClientError.ErrorCode.VALIDATION_ERROR.value:
        return ParallelClusterFlaskApp._handle_parallel_cluster_api_exception(BadRequestException(str(exception)))
    if exception.error_code in AWSClientError.ErrorCode.throttling_error_codes():
        return ParallelClusterFlaskApp._handle_parallel_cluster_api_exception(
            LimitExceededException(str(exception))
        )
    return ParallelClusterFlaskApp._handle_parallel_cluster_api_exception(
        InternalServiceException(f"Failed when calling AWS service in {exception.function_name}: {exception}")
    )