code: def test_model_card_create_read_and_delete_with_model_package(
      sagemaker_session,
      business_details,
      intended_uses,
      model_package,
  ):
      model_package_arn1, model_package_arn2 = model_package
      model_card_name1 = unique_name_from_base("model-card1")
      model_card_name2 = unique_name_from_base("model-card2")
  
      with timeout(minutes=MODEL_CARD_DEFAULT_TIMEOUT_MINUTES):
          model_package_details1 = ModelPackage.from_model_package_arn(
              model_package_arn=model_package_arn1,
              sagemaker_session=sagemaker_session,
          )
  
          assert (
              model_package_details1.model_package_arn
              == model_package_arn1
          )
          assert (
              model_package_details1.model_approval_status
              == ModelApprovalStatusEnum.PENDING_MANUAL_APPROVAL
          )
  
          # create first model card with business details and intended uses
          card1 = ModelCard(
              name=model_card_name1,
              status=ModelCardStatusEnum.DRAFT,
              business_details=business_details,
              intended_uses=intended_uses,
              model_package_details=model_package_details1,
              sagemaker_session=sagemaker_session,
          )
  
          # validate that there is an auto discovered training details
          assert card1.training_details.training_job_details is not None
  
          card1.create()
          assert card1.arn
  
          # create second model card with model package that has evaluation details and carried over information
          model_package_details2 = ModelPackage.from_model_package_arn(
              model_package_arn=model_package_arn2,
              sagemaker_session=sagemaker_session,
          )
  
          try:
              # Wait for the new model card (card1) to be indexed in the Search
              for _ in retries(
                  max_retry_count=5,
                  exception_message_prefix="Waiting for Search to index model card(card1)",
                  seconds_to_sleep=3,
              ):
                  card2 = ModelCard(
                      name=model_card_name2,
                      status=ModelCardStatusEnum.DRAFT,
                      model_package_details=model_package_details2,
                      sagemaker_session=sagemaker_session,
                  )
  
                  if card2.business_details is not None:
                      break
          except Exception as error:
              logging.error(error)
              # Delete card1 if it was not indexed after 5 retries as a clean up process
              card1.delete()
  
          # validate that there are auto discovered training details and evaluation details
          assert card2.training_details.training_job_details is not None
          assert card2.evaluation_details is not None
  
          # validate the carry over information like business details and intended_uses
          assert (
              card2.business_details.business_problem
              == business_details.business_problem
          )
          assert (
              card2.intended_uses.purpose_of_model
              == intended_uses.purpose_of_model
          )
  
          card2.create()
          assert card2.arn
  
          # cleanup resources
          card1.delete()
          card2.delete()
  
      # Validate resource cleanup
      with pytest.raises(Exception) as exception:
          sagemaker_session.sagemaker_client.describe_model_card(
              ModelCardName=model_card_name1
          )
          assert "does not exist" in str(exception.value)
  
          sagemaker_session.sagemaker_client.describe_model_card(
              ModelCardName=model_card_name2
          )
          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 8 for calling a global function with example usage: test_model_card_create_read_and_delete_with_model_package(sagemaker_session, business_details, intended_uses, model_package) without return types