code: def test_model_card_create_read_update_and_delete(
      sagemaker_session,
      binary_classifier,
  ):
      model_name, training_job_name = binary_classifier
  
      with timeout(minutes=MODEL_CARD_DEFAULT_TIMEOUT_MINUTES):
          model_card_name = unique_name_from_base("model-card")
  
          model_overview = ModelOverview.from_model_name(
              model_name=model_name,
              sagemaker_session=sagemaker_session,
          )
          assert model_overview.model_id
  
          training_details1 = TrainingDetails.from_training_job_name(
              training_job_name=training_job_name,
              sagemaker_session=sagemaker_session,
          )
          assert training_details1.training_job_details.training_arn
          training_details2 = TrainingDetails.from_model_overview(
              model_overview=model_overview,
              sagemaker_session=sagemaker_session,
          )
          assert (
              training_details1.training_job_details.training_arn
              == training_details2.training_job_details.training_arn
          )
          assert (
              training_details1.training_job_details.training_environment.container_image[
                  0
              ]
              == training_details2.training_job_details.training_environment.container_image[
                  0
              ]
          )
          assert len(
              training_details1.training_job_details.training_metrics
          ) == len(
              training_details2.training_job_details.training_metrics
          )
  
          card = ModelCard(
              name=model_card_name,
              status=ModelCardStatusEnum.DRAFT,
              model_overview=model_overview,
              training_details=training_details1,
              sagemaker_session=sagemaker_session,
          )
          card.create()
          assert card.arn
  
          new_model_description = "the model card is updated."
          card.model_overview.model_description = new_model_description
          card.update()
          assert len(card.get_version_history()) == 2
  
          card_copy = ModelCard.load(
              name=model_card_name,
              sagemaker_session=sagemaker_session,
          )
          assert card_copy.arn == card.arn
          assert (
              card_copy.model_overview.model_description
              == new_model_description
          )
  
          # export job
          bucket = sagemaker_session.default_bucket()
          prefix = "integ-test-data/model-card"
          s3_output_path = f"s3://{bucket}/{prefix}/export"
          pdf_s3_url = card.export_pdf(
              export_job_name=f"export-{model_card_name}",
              s3_output_path=s3_output_path,
          )
          parsed_url = urlparse(pdf_s3_url)
          pdf_bucket = parsed_url.netloc
          pdf_key = parsed_url.path.lstrip("/")
          region = sagemaker_session.boto_region_name
          s3 = sagemaker_session.boto_session.client(
              "s3", region_name=region
          )
          assert (
              s3.list_objects_v2(Bucket=pdf_bucket, Prefix=pdf_key)[
                  "KeyCount"
              ]
              == 1
          )
  
          # list export jobs
          assert (
              len(
                  card.list_export_jobs()["ModelCardExportJobSummaries"]
              )
              == 1
          )
  
          # clean resources
          s3.delete_object(Bucket=pdf_bucket, Key=pdf_key)
          card.delete()
  
      # Validate resource cleanup
      with pytest.raises(Exception) as exception:
          sagemaker_session.sagemaker_client.describe_model_card(
              ModelCardName=model_card_name
          )
          assert "does not exist" in str(exception.value)
  
          s3.get_object(Bucket=pdf_bucket, Key=pdf_key)
          assert "The specified key 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 7 for calling a global function with example usage: test_model_card_create_read_update_and_delete(sagemaker_session, binary_classifier) without return types