code: def _add_extra_model_kwargs(
      kwargs: JumpStartModelInitKwargs,
  ) -> JumpStartModelInitKwargs:
      """Sets extra kwargs based on default or override, returns full kwargs."""
  
      model_kwargs_to_add = _retrieve_model_init_kwargs(
          model_id=kwargs.model_id,
          model_version=kwargs.model_version,
          region=kwargs.region,
          tolerate_deprecated_model=kwargs.tolerate_deprecated_model,
          tolerate_vulnerable_model=kwargs.tolerate_vulnerable_model,
          sagemaker_session=kwargs.sagemaker_session,
      )
  
      for key, value in model_kwargs_to_add.items():
          if getattr(kwargs, key) is None:
              resolved_value = resolve_model_sagemaker_config_field(
                  field_name=key,
                  field_val=value,
                  sagemaker_session=kwargs.sagemaker_session,
              )
              setattr(kwargs, key, resolved_value)
  
      return kwargs
  
imports: from __future__ import absolute_import
  import json
  from typing import Any, Dict, List, Optional, Union
  from sagemaker import environment_variables, image_uris, instance_types, model_uris, script_uris
  from sagemaker.async_inference.async_inference_config import AsyncInferenceConfig
  from sagemaker.base_deserializers import BaseDeserializer
  from sagemaker.base_serializers import BaseSerializer
  from sagemaker.explainer.explainer_config import ExplainerConfig
  from sagemaker.jumpstart.artifacts import _model_supports_inference_script_uri, _retrieve_model_init_kwargs, _retrieve_model_deploy_kwargs, _retrieve_model_package_arn
  from sagemaker.jumpstart.artifacts.resource_names import _retrieve_resource_name_base
  from sagemaker.jumpstart.constants import DEFAULT_JUMPSTART_SAGEMAKER_SESSION, INFERENCE_ENTRY_POINT_SCRIPT_NAME, JUMPSTART_DEFAULT_REGION_NAME, JUMPSTART_LOGGER
  from sagemaker.model_metrics import ModelMetrics
  from sagemaker.metadata_properties import MetadataProperties
  from sagemaker.drift_check_baselines import DriftCheckBaselines
  from sagemaker.jumpstart.enums import JumpStartScriptScope
  from sagemaker.jumpstart.types import JumpStartModelDeployKwargs, JumpStartModelInitKwargs, JumpStartModelRegisterKwargs
  from sagemaker.jumpstart.utils import add_jumpstart_model_id_version_tags, update_dict_if_key_not_present, resolve_model_sagemaker_config_field, verify_model_region_and_return_specs
  from sagemaker.model_monitor.data_capture_config import DataCaptureConfig
  from sagemaker.base_predictor import Predictor
  from sagemaker import accept_types, content_types, serializers, deserializers
  from sagemaker.serverless.serverless_inference_config import ServerlessInferenceConfig
  from sagemaker.session import Session
  from sagemaker.utils import name_from_base, format_tags, Tags
  from sagemaker.workflow.entities import PipelineVariable
  from sagemaker.compute_resource_requirements.resource_requirements import ResourceRequirements
  from sagemaker import resource_requirements
  from sagemaker.enums import EndpointType
label_desc: Use image node_id 14 for calling a global function with example usage: _add_extra_model_kwargs(kwargs) and returns: kwargs