code: def advanced_right_sized_unregistered_model(
      sagemaker_session, cpu_instance_type
  ):
      with timeout(minutes=45):
          try:
              model_data = sagemaker_session.upload_data(
                  path=IR_SKLEARN_MODEL
              )
              payload_data = sagemaker_session.upload_data(
                  path=IR_SKLEARN_PAYLOAD
              )
  
              iam_client = sagemaker_session.boto_session.client("iam")
              role_arn = iam_client.get_role(RoleName="SageMakerRole")[
                  "Role"
              ]["Arn"]
  
              sklearn_model = SKLearnModel(
                  model_data=model_data,
                  role=role_arn,
                  entry_point=IR_SKLEARN_ENTRY_POINT,
                  framework_version=IR_SKLEARN_FRAMEWORK_VERSION,
              )
  
              hyperparameter_ranges = [
                  {
                      "instance_types": CategoricalParameter(
                          [cpu_instance_type]
                      ),
                      "TEST_PARAM": CategoricalParameter(
                          ["TEST_PARAM_VALUE_1", "TEST_PARAM_VALUE_2"]
                      ),
                  }
              ]
  
              phases = [
                  Phase(
                      duration_in_seconds=300,
                      initial_number_of_users=2,
                      spawn_rate=2,
                  ),
                  Phase(
                      duration_in_seconds=300,
                      initial_number_of_users=14,
                      spawn_rate=2,
                  ),
              ]
  
              model_latency_thresholds = [
                  ModelLatencyThreshold(
                      percentile="P95", value_in_milliseconds=100
                  )
              ]
  
              return retry_and_back_off(
                  sklearn_model.right_size(
                      sample_payload_url=payload_data,
                      supported_content_types=IR_SKLEARN_CONTENT_TYPE,
                      framework=IR_SKLEARN_FRAMEWORK,
                      job_duration_in_seconds=3600,
                      hyperparameter_ranges=hyperparameter_ranges,
                      phases=phases,
                      model_latency_thresholds=model_latency_thresholds,
                      max_invocations=100,
                      max_tests=5,
                      max_parallel_tests=5,
                      log_level="Quiet",
                  )
              )
  
          except Exception:
              sagemaker_session.delete_model(
                  model_name=sklearn_model.name
              )
  
imports: from __future__ import absolute_import
  import os
  import time
  import pytest
  from botocore.exceptions import ClientError
  from sagemaker import image_uris
  from sagemaker.model import Model
  from sagemaker.sklearn.model import SKLearnModel, SKLearnPredictor
  from sagemaker.utils import unique_name_from_base
  from tests.integ import DATA_DIR
  from tests.integ.timeout import timeout
  import pandas
  from sagemaker.inference_recommender.inference_recommender_mixin import Phase, ModelLatencyThreshold
  from sagemaker.parameter import CategoricalParameter
  import logging
label_desc: Use image node_id 5 for calling a global function with example usage: advanced_right_sized_unregistered_model(sagemaker_session, cpu_instance_type) and returns: retry_and_back_off