code: def test_jumpstart_cache_get_header():
      cache = JumpStartModelsCache(s3_bucket_name="some_bucket")
  
      assert JumpStartModelHeader(
          {
              "model_id": "tensorflow-ic-imagenet-inception-v3-classification-4",
              "version": "2.0.0",
              "min_version": "2.49.0",
              "spec_key": "community_models_specs/tensorflow-ic"
              "-imagenet-inception-v3-classification-4/specs_v2.0.0.json",
          }
      ) == cache.get_header(
          model_id="tensorflow-ic-imagenet-inception-v3-classification-4",
          semantic_version_str="*",
      )
  
      # See if we can make the same query 2 times consecutively
      assert JumpStartModelHeader(
          {
              "model_id": "tensorflow-ic-imagenet-inception-v3-classification-4",
              "version": "2.0.0",
              "min_version": "2.49.0",
              "spec_key": "community_models_specs/tensorflow-ic"
              "-imagenet-inception-v3-classification-4/specs_v2.0.0.json",
          }
      ) == cache.get_header(
          model_id="tensorflow-ic-imagenet-inception-v3-classification-4",
          semantic_version_str="*",
      )
  
      assert JumpStartModelHeader(
          {
              "model_id": "tensorflow-ic-imagenet-inception-v3-classification-4",
              "version": "2.0.0",
              "min_version": "2.49.0",
              "spec_key": "community_models_specs/tensorflow-ic-"
              "imagenet-inception-v3-classification-4/specs_v2.0.0.json",
          }
      ) == cache.get_header(
          model_id="tensorflow-ic-imagenet-inception-v3-classification-4",
          semantic_version_str="2.*",
      )
  
      assert JumpStartModelHeader(
          {
              "model_id": "tensorflow-ic-imagenet-inception-v3-classification-4",
              "version": "2.0.0",
              "min_version": "2.49.0",
              "spec_key": "community_models_specs/tensorflow-ic-"
              "imagenet-inception-v3-classification-4/specs_v2.0.0.json",
          }
      ) == cache.get_header(
          model_id="tensorflow-ic-imagenet-inception-v3-classification-4",
          semantic_version_str="2.0.*",
      )
  
      assert JumpStartModelHeader(
          {
              "model_id": "tensorflow-ic-imagenet-inception-v3-classification-4",
              "version": "2.0.0",
              "min_version": "2.49.0",
              "spec_key": "community_models_specs/tensorflow-ic-"
              "imagenet-inception-v3-classification-4/specs_v2.0.0.json",
          }
      ) == cache.get_header(
          model_id="tensorflow-ic-imagenet-inception-v3-classification-4",
          semantic_version_str="2.0.0",
      )
  
      assert JumpStartModelHeader(
          {
              "model_id": "tensorflow-ic-imagenet-inception-v3-classification-4",
              "version": "1.0.0",
              "min_version": "2.49.0",
              "spec_key": "community_models_specs/tensorflow-ic-"
              "imagenet-inception-v3-classification-4/specs_v1.0.0.json",
          }
      ) == cache.get_header(
          model_id="tensorflow-ic-imagenet-inception-v3-classification-4",
          semantic_version_str="1.0.0",
      )
  
      assert JumpStartModelHeader(
          {
              "model_id": "tensorflow-ic-imagenet-inception-v3-classification-4",
              "version": "1.0.0",
              "min_version": "2.49.0",
              "spec_key": "community_models_specs/tensorflow-ic-"
              "imagenet-inception-v3-classification-4/specs_v1.0.0.json",
          }
      ) == cache.get_header(
          model_id="tensorflow-ic-imagenet-inception-v3-classification-4",
          semantic_version_str="1.*",
      )
  
      assert JumpStartModelHeader(
          {
              "model_id": "tensorflow-ic-imagenet-inception-v3-classification-4",
              "version": "1.0.0",
              "min_version": "2.49.0",
              "spec_key": "community_models_specs/tensorflow-ic-"
              "imagenet-inception-v3-classification-4/specs_v1.0.0.json",
          }
      ) == cache.get_header(
          model_id="tensorflow-ic-imagenet-inception-v3-classification-4",
          semantic_version_str="1.0.*",
      )
  
      with pytest.raises(KeyError) as e:
          cache.get_header(
              model_id="tensorflow-ic-imagenet-inception-v3-classification-4",
              semantic_version_str="3.*",
          )
      assert (
          "Unable to find model manifest for 'tensorflow-ic-imagenet-inception-v3-classification-4' "
          "with version '3.*' compatible with your SageMaker version ('2.68.3'). Consider upgrading "
          "your SageMaker library to at least version '4.49.0' so you can use version '3.0.0' of "
          "'tensorflow-ic-imagenet-inception-v3-classification-4'."
          in str(e.value)
      )
  
      with pytest.raises(KeyError) as e:
          cache.get_header(
              model_id="pytorch-ic-imagenet-inception-v3-classification-4",
              semantic_version_str="3.*",
          )
      assert (
          "Unable to find model manifest for 'pytorch-ic-imagenet-inception-v3-classification-4' with "
          "version '3.*'. Visit https://sagemaker.readthedocs.io/en/stable/doc_utils/pretrainedmodels.html "
          "for updated list of models. Consider using model ID 'pytorch-ic-imagenet-inception-v3-"
          "classification-4' with version '2.0.0'."
      ) in str(e.value)
  
      with pytest.raises(KeyError) as e:
          cache.get_header(
              model_id="pytorch-ic-", semantic_version_str="*"
          )
      assert (
          "Unable to find model manifest for 'pytorch-ic-' with version '*'. "
          "Visit https://sagemaker.readthedocs.io/en/stable/doc_utils/pretrainedmodels.html "
          "for updated list of models. "
          "Did you mean to use model ID 'pytorch-ic-imagenet-inception-v3-classification-4'?"
      ) in str(e.value)
  
      with pytest.raises(KeyError) as e:
          cache.get_header(
              model_id="tensorflow-ic-", semantic_version_str="*"
          )
      assert (
          "Unable to find model manifest for 'tensorflow-ic-' with version '*'. "
          "Visit https://sagemaker.readthedocs.io/en/stable/doc_utils/pretrainedmodels.html "
          "for updated list of models. "
          "Did you mean to use model ID 'tensorflow-ic-imagenet-inception-"
          "v3-classification-4'?"
      ) in str(e.value)
  
      with pytest.raises(KeyError):
          cache.get_header(
              model_id="tensorflow-ic-imagenet-inception-v3-classification-4",
              semantic_version_str="BAD",
          )
  
      with pytest.raises(KeyError):
          cache.get_header(
              model_id="tensorflow-ic-imagenet-inception-v3-classification-4",
              semantic_version_str="2.1.*",
          )
  
      with pytest.raises(KeyError):
          cache.get_header(
              model_id="tensorflow-ic-imagenet-inception-v3-classification-4",
              semantic_version_str="3.9.*",
          )
  
      with pytest.raises(KeyError):
          cache.get_header(
              model_id="tensorflow-ic-imagenet-inception-v3-classification-4",
              semantic_version_str="5.*",
          )
  
      with pytest.raises(KeyError):
          cache.get_header(
              model_id="tensorflow-ic-imagenet-inception-v3-classification-4-bak",
              semantic_version_str="*",
          )
  
imports: from __future__ import absolute_import
  import copy
  import datetime
  import io
  import json
  from unittest.mock import Mock, call, mock_open
  from botocore.stub import Stubber
  import botocore
  from mock.mock import MagicMock
  import pytest
  from mock import patch
  from sagemaker.jumpstart.cache import JUMPSTART_DEFAULT_MANIFEST_FILE_S3_KEY, JumpStartModelsCache
  from sagemaker.jumpstart.constants import ENV_VARIABLE_JUMPSTART_MANIFEST_LOCAL_ROOT_DIR_OVERRIDE, ENV_VARIABLE_JUMPSTART_SPECS_LOCAL_ROOT_DIR_OVERRIDE
  from sagemaker.jumpstart.types import JumpStartModelHeader, JumpStartModelSpecs, JumpStartVersionedModelId
  from tests.unit.sagemaker.jumpstart.utils import get_spec_from_base_spec, patched_retrieval_function
  from tests.unit.sagemaker.jumpstart.constants import BASE_MANIFEST, BASE_SPEC
  from sagemaker.jumpstart.utils import get_jumpstart_content_bucket
label_desc: Use image node_id 1 for calling a global function with example usage: test_jumpstart_cache_get_header() without return types