code: def _validate_instance_deprecation(framework, instance_type, version):
      """Check if instance type is deprecated for a certain framework with a certain version"""
      if utils.get_instance_type_family(instance_type) == "p2":
          if (
              framework == "pytorch"
              and Version(version) >= Version("1.13")
          ) or (
              framework == "tensorflow"
              and Version(version) >= Version("2.12")
          ):
              raise ValueError(
                  "P2 instances have been deprecated for sagemaker jobs starting PyTorch 1.13 and TensorFlow 2.12"
                  "For information about supported instance types please refer to "
                  "https://aws.amazon.com/sagemaker/pricing/"
              )
  
imports: from __future__ import absolute_import
  import json
  import logging
  import os
  import re
  from typing import Optional
  from packaging.version import Version
  from sagemaker import utils
  from sagemaker.jumpstart.constants import DEFAULT_JUMPSTART_SAGEMAKER_SESSION
  from sagemaker.jumpstart.utils import is_jumpstart_model_input
  from sagemaker.spark import defaults
  from sagemaker.jumpstart import artifacts
  from sagemaker.workflow import is_pipeline_variable
  from sagemaker.workflow.utilities import override_pipeline_parameter_var
  from sagemaker.fw_utils import GRAVITON_ALLOWED_TARGET_INSTANCE_FAMILY, GRAVITON_ALLOWED_FRAMEWORKS
label_desc: Use image node_id 4 for calling a global function with example usage: _validate_instance_deprecation(framework, instance_type, version) without return types