<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def tune(self, job_name, strategy, objective_type, objective_metric_name, max_jobs, max_parallel_jobs, parameter_ranges, static_hyperparameters, input_mode, metric_definitions, role, input_config, output_config, resource_config, stop_condition, tags, warm_start_config, enable_network_isolation=False, image=None, algorithm_arn=None, early_stopping_type='Off', encrypt_inter_container_traffic=False, vpc_config=None):
 """Create an Amazon SageMaker hyperparameter tuning job Args: job_name (str):
 Name of the tuning job being created. strategy (str):
 Strategy to be used for hyperparameter estimations. objective_type (str):
 The type of the objective metric for evaluating training jobs. This value can be either 'Minimize' or 'Maximize'. objective_metric_name (str):
 Name of the metric for evaluating training jobs. max_jobs (int):
 Maximum total number of training jobs to start for the hyperparameter tuning job. max_parallel_jobs (int):
 Maximum number of parallel training jobs to start. parameter_ranges (dict):
 Dictionary of parameter ranges. These parameter ranges can be one of three types: Continuous, Integer, or Categorical. static_hyperparameters (dict):
 Hyperparameters for model training. These hyperparameters remain unchanged across all of the training jobs for the hyperparameter tuning job. The hyperparameters are made accessible as a dictionary for the training code on SageMaker. image (str):
 Docker image containing training code. input_mode (str):
 The input mode that the algorithm supports. Valid modes: * 'File' - Amazon SageMaker copies the training dataset from the S3 location to a directory in the Docker container. * 'Pipe' - Amazon SageMaker streams data directly from S3 to the container via a Unix-named pipe. metric_definitions (list[dict]):
 A list of dictionaries that defines the metric(s) used to evaluate the training jobs. Each dictionary contains two keys: 'Name' for the name of the metric, and 'Regex' for the regular expression used to extract the metric from the logs. This should be defined only for jobs that don't use an Amazon algorithm. role (str):
 An AWS IAM role (either name or full ARN). The Amazon SageMaker training jobs and APIs that create Amazon SageMaker endpoints use this role to access training data and model artifacts. You must grant sufficient permissions to this role. input_config (list):
 A list of Channel objects. Each channel is a named input source. Please refer to the format details described: https://botocore.readthedocs.io/en/latest/reference/services/sagemaker.html#SageMaker.Client.create_training_job output_config (dict):
 The S3 URI where you want to store the training results and optional KMS key ID. resource_config (dict):
 Contains values for ResourceConfig: * instance_count (int):
 Number of EC2 instances to use for training. The key in resource_config is 'InstanceCount'. * instance_type (str):
 Type of EC2 instance to use for training, for example, 'ml.c4.xlarge'. The key in resource_config is 'InstanceType'. stop_condition (dict):
 When training should finish, e.g. ``MaxRuntimeInSeconds``. tags (list[dict]):
 List of tags for labeling the tuning job. For more, see https://docs.aws.amazon.com/sagemaker/latest/dg/API_Tag.html. warm_start_config (dict):
 Configuration defining the type of warm start and other required configurations. early_stopping_type (str):
 Specifies whether early stopping is enabled for the job. Can be either 'Auto' or 'Off'. If set to 'Off', early stopping will not be attempted. If set to 'Auto', early stopping of some training jobs may happen, but is not guaranteed to. encrypt_inter_container_traffic (bool):
 Specifies whether traffic between training containers is encrypted for the training jobs started for this hyperparameter tuning job (default: ``False``). vpc_config (dict):
 Contains values for VpcConfig (default: None):
 * subnets (list[str]):
 List of subnet ids. The key in vpc_config is 'Subnets'. * security_group_ids (list[str]):
 List of security group ids. The key in vpc_config is 'SecurityGroupIds'. """

        tune_request = {
            'HyperParameterTuningJobName': job_name,
            'HyperParameterTuningJobConfig': {
                'Strategy': strategy,
                'HyperParameterTuningJobObjective': {
                    'Type': objective_type,
                    'MetricName': objective_metric_name,
                },
                'ResourceLimits': {
                    'MaxNumberOfTrainingJobs': max_jobs,
                    'MaxParallelTrainingJobs': max_parallel_jobs,
                },
                'ParameterRanges': parameter_ranges,
                'TrainingJobEarlyStoppingType': early_stopping_type,
            },
            'TrainingJobDefinition': {
                'StaticHyperParameters': static_hyperparameters,
                'RoleArn': role,
                'OutputDataConfig': output_config,
                'ResourceConfig': resource_config,
                'StoppingCondition': stop_condition,
            }
        }

        algorithm_spec = {
            'TrainingInputMode': input_mode
        }
        if algorithm_arn:
            algorithm_spec['AlgorithmName'] = algorithm_arn
        else:
            algorithm_spec['TrainingImage'] = image

        tune_request['TrainingJobDefinition']['AlgorithmSpecification'] = algorithm_spec

        if input_config is not None:
            tune_request['TrainingJobDefinition']['InputDataConfig'] = input_config

        if warm_start_config:
            tune_request['WarmStartConfig'] = warm_start_config

        if metric_definitions is not None:
            tune_request['TrainingJobDefinition']['AlgorithmSpecification']['MetricDefinitions'] = metric_definitions

        if tags is not None:
            tune_request['Tags'] = tags

        if vpc_config is not None:
            tune_request['TrainingJobDefinition']['VpcConfig'] = vpc_config

        if enable_network_isolation:
            tune_request['TrainingJobDefinition']['EnableNetworkIsolation'] = True

        if encrypt_inter_container_traffic:
            tune_request['TrainingJobDefinition']['EnableInterContainerTrafficEncryption'] = True

        LOGGER.info('Creating hyperparameter tuning job with name: {}'.format(job_name))
        LOGGER.debug('tune request: {}'.format(json.dumps(tune_request, indent=4)))
        self.sagemaker_client.create_hyper_parameter_tuning_job(**tune_request)