async def METHOD_NAME(self, request: Request) -> Response:
    """Executes a prediction.
    Args:
        request (Request):
            Required. The prediction request.
    Returns:
        The response containing prediction results.
    Raises:
        HTTPException: If the handle function of the handler raises any exceptions.
    """
    try:
        return await self.handler.handle(request)
    except HTTPException:
        # Raises exception if it's a HTTPException.
        raise
    except Exception as exception:
        error_message = "An exception {} occurred. Arguments: {}.".format(
            type(exception).__name__, exception.args
        )
        logging.info(
            "{}\\nTraceback: {}".format(error_message, traceback.format_exc())
        )
        # Converts all other exceptions to HTTPException.
        if self.is_default_handler:
            raise HTTPException(
                status_code=500,
                detail=error_message,
                headers={
                    prediction.CUSTOM_PREDICTION_ROUTINES_SERVER_ERROR_HEADER_KEY: version.__version__
                },
            )
        raise HTTPException(status_code=500, detail=error_message)