code: def test_jumpstart_vulnerable_model_errors(patched_get_model_specs):
      def make_vulnerable_inference_spec(*largs, **kwargs):
          spec = get_spec_from_base_spec(*largs, **kwargs)
          spec.inference_vulnerable = True
          spec.inference_vulnerabilities = ["some", "vulnerability"]
          return spec
  
      patched_get_model_specs.side_effect = (
          make_vulnerable_inference_spec
      )
  
      with pytest.raises(VulnerableJumpStartModelError) as e:
          utils.verify_model_region_and_return_specs(
              model_id="pytorch-eqa-bert-base-cased",
              version="*",
              scope=JumpStartScriptScope.INFERENCE.value,
              region="us-west-2",
          )
      assert (
          "Version '*' of JumpStart model 'pytorch-eqa-bert-base-cased' has at least 1 "
          "vulnerable dependency in the inference script. "
          "We recommend that you specify a more recent model version or "
          "choose a different model. To access the "
          "latest models and model versions, be sure to upgrade "
          "to the latest version of the SageMaker Python SDK. "
          "List of vulnerabilities: some, vulnerability"
      ) == str(e.value.message)
  
      def make_vulnerable_training_spec(*largs, **kwargs):
          spec = get_spec_from_base_spec(*largs, **kwargs)
          spec.training_vulnerable = True
          spec.training_vulnerabilities = ["some", "vulnerability"]
          return spec
  
      patched_get_model_specs.side_effect = (
          make_vulnerable_training_spec
      )
  
      with pytest.raises(VulnerableJumpStartModelError) as e:
          utils.verify_model_region_and_return_specs(
              model_id="pytorch-eqa-bert-base-cased",
              version="*",
              scope=JumpStartScriptScope.TRAINING.value,
              region="us-west-2",
          )
      assert (
          "Version '*' of JumpStart model 'pytorch-eqa-bert-base-cased' has at least 1 "
          "vulnerable dependency in the training script. "
          "We recommend that you specify a more recent model version or "
          "choose a different model. To access the "
          "latest models and model versions, be sure to upgrade "
          "to the latest version of the SageMaker Python SDK. "
          "List of vulnerabilities: some, vulnerability"
      ) == str(e.value.message)
  
imports: from __future__ import absolute_import
  import os
  from unittest import TestCase
  from mock.mock import Mock, patch
  import pytest
  import random
  from sagemaker.jumpstart import utils
  from sagemaker.jumpstart.constants import DEFAULT_JUMPSTART_SAGEMAKER_SESSION, ENV_VARIABLE_DISABLE_JUMPSTART_LOGGING, ENV_VARIABLE_JUMPSTART_CONTENT_BUCKET_OVERRIDE, ENV_VARIABLE_JUMPSTART_GATED_CONTENT_BUCKET_OVERRIDE, JUMPSTART_DEFAULT_REGION_NAME, JUMPSTART_GATED_AND_PUBLIC_BUCKET_NAME_SET, JUMPSTART_LOGGER, JUMPSTART_REGION_NAME_SET, JUMPSTART_RESOURCE_BASE_NAME, JumpStartScriptScope
  from functools import partial
  from sagemaker.jumpstart.enums import JumpStartTag, MIMEType
  from sagemaker.jumpstart.exceptions import DeprecatedJumpStartModelError, VulnerableJumpStartModelError
  from sagemaker.jumpstart.types import JumpStartModelHeader, JumpStartVersionedModelId
  from tests.unit.sagemaker.jumpstart.utils import get_spec_from_base_spec
  from mock import MagicMock
label_desc: Use image node_id 25 for calling a global function with example usage: test_jumpstart_vulnerable_model_errors(patched_get_model_specs) and returns: spec, spec