code: def model_package_fixture(
      sagemaker_session: Session,
      training_job: Estimator,
      evaluation_data: Tuple[str, str],
  ):
      """Manage model package groups and model packages for the model card integration test"""
      model_package_group_name = unique_name_from_base(
          "test-model-package-group"
      )
      training_job_name = training_job.latest_training_job.name
      model_quality_s3_uri, bias_s3_uri = evaluation_data
      with timeout(minutes=MODEL_CARD_DEFAULT_TIMEOUT_MINUTES):
          sagemaker_session.sagemaker_client.create_model_package_group(
              ModelPackageGroupName=model_package_group_name
          )
  
          training_job = (
              sagemaker_session.sagemaker_client.describe_training_job(
                  TrainingJobName=training_job_name
              )
          )
  
          model_data_url = training_job["ModelArtifacts"][
              "S3ModelArtifacts"
          ]
          image = training_job["AlgorithmSpecification"][
              "TrainingImage"
          ]
  
          create_model_package_input_dict = {
              "ModelPackageGroupName": model_package_group_name,
              "ModelPackageDescription": "Test model package registered for integ test",
              "ModelApprovalStatus": ModelApprovalStatusEnum.PENDING_MANUAL_APPROVAL,
              "InferenceSpecification": {
                  "Containers": [
                      {"Image": image, "ModelDataUrl": model_data_url}
                  ],
                  "SupportedContentTypes": ["text/csv"],
                  "SupportedResponseMIMETypes": ["text/csv"],
              },
          }
  
          model_pkg1 = (
              sagemaker_session.sagemaker_client.create_model_package(
                  **create_model_package_input_dict
              )
          )
  
          # creating another model package with ModelMetrics(evaluation data)
          model_metrics_data = {
              "ModelMetrics": {
                  "ModelQuality": {
                      "Statistics": {
                          "ContentType": "application/json",
                          "S3Uri": model_quality_s3_uri,
                      }
                  },
                  "Bias": {
                      "Report": {
                          "ContentType": "application/json",
                          "S3Uri": bias_s3_uri,
                      }
                  },
                  "Explainability": {},
              }
          }
  
          create_model_package_input_dict.update(model_metrics_data)
          model_pkg2 = (
              sagemaker_session.sagemaker_client.create_model_package(
                  **create_model_package_input_dict
              )
          )
  
          # Yield to run the integration tests
          yield model_pkg1["ModelPackageArn"], model_pkg2[
              "ModelPackageArn"
          ]
  
          # clean up resources
          sagemaker_session.sagemaker_client.delete_model_package(
              ModelPackageName=model_pkg1["ModelPackageArn"]
          )
          sagemaker_session.sagemaker_client.delete_model_package(
              ModelPackageName=model_pkg2["ModelPackageArn"]
          )
          sagemaker_session.sagemaker_client.delete_model_package_group(
              ModelPackageGroupName=model_package_group_name
          )
  
      # Validate resource cleanup
      with pytest.raises(Exception) as exception:
          sagemaker_session.sagemaker_client.describe_model_package(
              ModelPackageName=model_pkg1["ModelPackageArn"]
          )
          assert "does not exist" in str(exception.value)
  
          sagemaker_session.sagemaker_client.describe_model_package(
              ModelPackageName=model_pkg2["ModelPackageArn"]
          )
          assert "does not exist" in str(exception.value)
  
          sagemaker_session.sagemaker_client.describe_model_package_group(
              ModelPackageGroupName=model_package_group_name
          )
          assert "does not exist" in str(exception.value)
  
imports: from __future__ import absolute_import
  import os
  import io
  import numpy
  import pytest
  import logging
  from six.moves.urllib.parse import urlparse
  from typing import Tuple
  from sagemaker import s3
  from sagemaker.estimator import Estimator
  import sagemaker
  from sagemaker.session import Session
  import sagemaker.amazon.common
  from sagemaker.image_uris import retrieve
  from sagemaker.utils import unique_name_from_base
  from sagemaker.model_card import ModelCard, ModelOverview, TrainingDetails, ModelCardStatusEnum, ModelPackage, BusinessDetails, IntendedUses, schema_constraints
  from sagemaker.model_card.model_card import ModelApprovalStatusEnum
  from tests.integ import MODEL_CARD_DEFAULT_TIMEOUT_MINUTES, DATA_DIR
  from tests.integ.timeout import timeout, timeout_and_delete_model_by_name
  from tests.integ.retry import retries
label_desc: Use image node_id 4 for calling a global function with example usage: model_package_fixture(sagemaker_session, training_job, evaluation_data) without return types