Deploy the best trained or user specified model to an Amazon SageMaker endpoint and return a
        ``sagemaker.RealTimePredictor`` object.

        For more information: http://docs.aws.amazon.com/sagemaker/latest/dg/how-it-works-training.html

        Args:
            initial_instance_count (int): Minimum number of EC2 instances to deploy to an endpoint for prediction.
            instance_type (str): Type of EC2 instance to deploy to an endpoint for prediction,
                for example, 'ml.c4.xlarge'.
            accelerator_type (str): Type of Elastic Inference accelerator to attach to an endpoint for model loading
                and inference, for example, 'ml.eia1.medium'. If not specified, no Elastic Inference accelerator
                will be attached to the endpoint.
                For more information: https://docs.aws.amazon.com/sagemaker/latest/dg/ei.html
            endpoint_name (str): Name to use for creating an Amazon SageMaker endpoint. If not specified,
                the name of the training job is used.
            **kwargs: Other arguments needed for deployment. Please refer to the ``create_model()`` method of
                the associated estimator to see what other arguments are needed.

        Returns:
            sagemaker.predictor.RealTimePredictor: A predictor that provides a ``predict()`` method,
                which can be used to send requests to the Amazon SageMaker endpoint and obtain inferences.

def deploy(self, initial_instance_count, instance_type, accelerator_type=None, endpoint_name=None, **kwargs):
        """Deploy the best trained or user specified model to an Amazon SageMaker endpoint and return a
        ``sagemaker.RealTimePredictor`` object.

        For more information: http://docs.aws.amazon.com/sagemaker/latest/dg/how-it-works-training.html

        Args:
            initial_instance_count (int): Minimum number of EC2 instances to deploy to an endpoint for prediction.
            instance_type (str): Type of EC2 instance to deploy to an endpoint for prediction,
                for example, 'ml.c4.xlarge'.
            accelerator_type (str): Type of Elastic Inference accelerator to attach to an endpoint for model loading
                and inference, for example, 'ml.eia1.medium'. If not specified, no Elastic Inference accelerator
                will be attached to the endpoint.
                For more information: https://docs.aws.amazon.com/sagemaker/latest/dg/ei.html
            endpoint_name (str): Name to use for creating an Amazon SageMaker endpoint. If not specified,
                the name of the training job is used.
            **kwargs: Other arguments needed for deployment. Please refer to the ``create_model()`` method of
                the associated estimator to see what other arguments are needed.

        Returns:
            sagemaker.predictor.RealTimePredictor: A predictor that provides a ``predict()`` method,
                which can be used to send requests to the Amazon SageMaker endpoint and obtain inferences.
        """
        endpoint_name = endpoint_name or self.best_training_job()
        best_estimator = self.estimator.attach(self.best_training_job(),
                                               sagemaker_session=self.estimator.sagemaker_session)
        return best_estimator.deploy(initial_instance_count, instance_type,
                                     accelerator_type=accelerator_type,
                                     endpoint_name=endpoint_name, **kwargs)