code: def test_create_model_package(
      sagemaker_session, boto_session, iris_image
  ):
      MODEL_NAME = "iris-classifier-mp"
      # Prepare
      s3_bucket = sagemaker_session.default_bucket()
  
      model_name = unique_name_from_base(MODEL_NAME)
      model_description = "This model accepts petal length, petal width, sepal length, sepal width and predicts whether \
      flower is of type setosa, versicolor, or virginica"
  
      supported_realtime_inference_instance_types = (
          supported_batch_transform_instance_types
      ) = ["ml.m4.xlarge"]
      supported_content_types = [
          "text/csv",
          "application/json",
          "application/jsonlines",
      ]
      supported_response_MIME_types = [
          "application/json",
          "text/csv",
          "application/jsonlines",
      ]
  
      validation_input_path = (
          "s3://" + s3_bucket + "/validation-input-csv/"
      )
      validation_output_path = (
          "s3://" + s3_bucket + "/validation-output-csv/"
      )
  
      iam = boto_session.resource("iam")
      role = iam.Role("SageMakerRole").arn
      sm_client = boto_session.client("sagemaker")
      s3_client = boto_session.client("s3")
      s3_client.put_object(
          Bucket=s3_bucket,
          Key="validation-input-csv/input.csv",
          Body="5.1, 3.5, 1.4, 0.2",
      )
  
      ValidationSpecification = {
          "ValidationRole": role,
          "ValidationProfiles": [
              {
                  "ProfileName": "Validation-test",
                  "TransformJobDefinition": {
                      "BatchStrategy": "SingleRecord",
                      "TransformInput": {
                          "DataSource": {
                              "S3DataSource": {
                                  "S3DataType": "S3Prefix",
                                  "S3Uri": validation_input_path,
                              }
                          },
                          "ContentType": supported_content_types[0],
                      },
                      "TransformOutput": {
                          "S3OutputPath": validation_output_path,
                      },
                      "TransformResources": {
                          "InstanceType": supported_batch_transform_instance_types[
                              0
                          ],
                          "InstanceCount": 1,
                      },
                  },
              },
          ],
      }
  
      # get pre-existing model artifact stored in ECR
      model = Model(
          image_uri=iris_image,
          model_data=validation_input_path + "input.csv",
          role=role,
          sagemaker_session=sagemaker_session,
          enable_network_isolation=False,
      )
  
      # Call model.register() - the method under test - to create a model package
      model.register(
          supported_content_types,
          supported_response_MIME_types,
          supported_realtime_inference_instance_types,
          supported_batch_transform_instance_types,
          marketplace_cert=True,
          description=model_description,
          model_package_name=model_name,
          validation_specification=ValidationSpecification,
      )
  
      # wait for model execution to complete
      time.sleep(60 * 3)
  
      # query for all model packages with the name <MODEL_NAME>
      response = sm_client.list_model_packages(
          MaxResults=10,
          NameContains=MODEL_NAME,
          SortBy="CreationTime",
          SortOrder="Descending",
      )
  
      if len(response["ModelPackageSummaryList"]) > 0:
          sm_client.delete_model_package(ModelPackageName=model_name)
  
      # assert that response is non-empty
      assert len(response["ModelPackageSummaryList"]) > 0
  
imports: from __future__ import absolute_import
  import itertools
  import os
  import time
  import requests
  import pandas
  import pytest
  import docker
  import sagemaker
  import tests.integ
  from tests.integ.utils import create_repository
  from sagemaker import AlgorithmEstimator, ModelPackage, Model
  from sagemaker.serializers import CSVSerializer
  from sagemaker.tuner import IntegerParameter, HyperparameterTuner
  from sagemaker.utils import sagemaker_timestamp, _aws_partition, unique_name_from_base
  from tests.integ import DATA_DIR
  from tests.integ.timeout import timeout, timeout_and_delete_endpoint_by_name
  from tests.integ.marketplace_utils import REGION_ACCOUNT_MAP
  from tests.integ.test_multidatamodel import _ecr_image_uri, _ecr_login, _delete_repository
  from tests.integ.retry import retries
  import logging
label_desc: Use image node_id 5 for calling a global function with example usage: test_create_model_package(sagemaker_session, boto_session, iris_image) without return types