code: def _validate_hyperparameter(
      hyperparameter_name: str,
      hyperparameter_value: Any,
      hyperparameter_specs: List[JumpStartHyperparameter],
  ) -> None:
      """Perform low-level hyperparameter validation on single parameter.
  
      Args:
        hyperparameter_name (str): The name of the hyperparameter to validate.
        hyperparameter_value (Any): The value of the hyperparemter to validate.
        hyperparameter_specs (List[JumpStartHyperparameter]): List of ``JumpStartHyperparameter`` to
          use when validating the hyperparameter.
  
      Raises:
          JumpStartHyperparametersError: If the hyperparameter is not formatted correctly,
              according to its specs in the model metadata.
      """
      hyperparameter_spec = [
          spec
          for spec in hyperparameter_specs
          if spec.name == hyperparameter_name
      ]
      if len(hyperparameter_spec) == 0:
          raise JumpStartHyperparametersError(
              f"Unable to perform validation -- cannot find hyperparameter '{hyperparameter_name}' "
              "in model specs."
          )
  
      if len(hyperparameter_spec) > 1:
          raise JumpStartHyperparametersError(
              "Unable to perform validation -- found multiple hyperparameter "
              f"'{hyperparameter_name}' in model specs."
          )
  
      hyperparameter_spec = hyperparameter_spec[0]
  
      if hyperparameter_spec.type == VariableTypes.BOOL.value:
          if isinstance(hyperparameter_value, bool):
              return
          if not isinstance(hyperparameter_value, str):
              raise JumpStartHyperparametersError(
                  f"Expecting boolean valued hyperparameter, but got '{str(hyperparameter_value)}'."
              )
          if str(hyperparameter_value).lower() not in ["true", "false"]:
              raise JumpStartHyperparametersError(
                  f"Expecting boolean valued hyperparameter, but got '{str(hyperparameter_value)}'."
              )
      elif hyperparameter_spec.type == VariableTypes.TEXT.value:
          if not isinstance(hyperparameter_value, str):
              raise JumpStartHyperparametersError(
                  "Expecting text valued hyperparameter to have string type."
              )
  
          if hasattr(hyperparameter_spec, "options"):
              if (
                  hyperparameter_value
                  not in hyperparameter_spec.options
              ):
                  raise JumpStartHyperparametersError(
                      f"Hyperparameter '{hyperparameter_name}' must have one of the following "
                      f"values: {', '.join(hyperparameter_spec.options)}."
                  )
  
          if hasattr(hyperparameter_spec, "min"):
              if len(hyperparameter_value) < hyperparameter_spec.min:
                  raise JumpStartHyperparametersError(
                      f"Hyperparameter '{hyperparameter_name}' must have length no less than "
                      f"{hyperparameter_spec.min}."
                  )
  
          if hasattr(hyperparameter_spec, "exclusive_min"):
              if (
                  len(hyperparameter_value)
                  <= hyperparameter_spec.exclusive_min
              ):
                  raise JumpStartHyperparametersError(
                      f"Hyperparameter '{hyperparameter_name}' must have length greater than "
                      f"{hyperparameter_spec.exclusive_min}."
                  )
  
          if hasattr(hyperparameter_spec, "max"):
              if len(hyperparameter_value) > hyperparameter_spec.max:
                  raise JumpStartHyperparametersError(
                      f"Hyperparameter '{hyperparameter_name}' must have length no greater than "
                      f"{hyperparameter_spec.max}."
                  )
  
          if hasattr(hyperparameter_spec, "exclusive_max"):
              if (
                  len(hyperparameter_value)
                  >= hyperparameter_spec.exclusive_max
              ):
                  raise JumpStartHyperparametersError(
                      f"Hyperparameter '{hyperparameter_name}' must have length less than "
                      f"{hyperparameter_spec.exclusive_max}."
                  )
  
      # validate numeric types
      elif hyperparameter_spec.type in [
          VariableTypes.INT.value,
          VariableTypes.FLOAT.value,
      ]:
          try:
              numeric_hyperparam_value = float(hyperparameter_value)
          except ValueError:
              raise JumpStartHyperparametersError(
                  f"Hyperparameter '{hyperparameter_name}' must be numeric type "
                  f"('{hyperparameter_value}')."
              )
  
          if hyperparameter_spec.type == VariableTypes.INT.value:
              hyperparameter_value_str = str(hyperparameter_value)
              start_index = 0
              if hyperparameter_value_str[0] in ["+", "-"]:
                  start_index = 1
              if not hyperparameter_value_str[start_index:].isdigit():
                  raise JumpStartHyperparametersError(
                      f"Hyperparameter '{hyperparameter_name}' must be integer type "
                      f"('{hyperparameter_value}')."
                  )
  
          if hasattr(hyperparameter_spec, "min"):
              if numeric_hyperparam_value < hyperparameter_spec.min:
                  raise JumpStartHyperparametersError(
                      f"Hyperparameter '{hyperparameter_name}' can be no less than "
                      f"{hyperparameter_spec.min}."
                  )
  
          if hasattr(hyperparameter_spec, "max"):
              if numeric_hyperparam_value > hyperparameter_spec.max:
                  raise JumpStartHyperparametersError(
                      f"Hyperparameter '{hyperparameter_name}' can be no greater than "
                      f"{hyperparameter_spec.max}."
                  )
  
          if hasattr(hyperparameter_spec, "exclusive_min"):
              if (
                  numeric_hyperparam_value
                  <= hyperparameter_spec.exclusive_min
              ):
                  raise JumpStartHyperparametersError(
                      f"Hyperparameter '{hyperparameter_name}' must be greater than "
                      f"{hyperparameter_spec.exclusive_min}."
                  )
  
          if hasattr(hyperparameter_spec, "exclusive_max"):
              if (
                  numeric_hyperparam_value
                  >= hyperparameter_spec.exclusive_max
              ):
                  raise JumpStartHyperparametersError(
                      f"Hyperparameter '{hyperparameter_name}' must be less than "
                      f"{hyperparameter_spec.exclusive_max}."
                  )
  
file_path: sagemaker-python-sdk/src/sagemaker/jumpstart/validators.py
imports: from __future__ import absolute_import
  from typing import Any, Dict, List, Optional
  from sagemaker import session
  from sagemaker.jumpstart.constants import JUMPSTART_DEFAULT_REGION_NAME
  from sagemaker.jumpstart.enums import HyperparameterValidationMode, JumpStartScriptScope, VariableScope, VariableTypes
  from sagemaker.jumpstart.exceptions import JumpStartHyperparametersError
  from sagemaker.jumpstart.types import JumpStartHyperparameter
  from sagemaker.jumpstart.utils import verify_model_region_and_return_specs
label_desc: Use image node_id 1 for calling a global function with example usage: _validate_hyperparameter(hyperparameter_name, hyperparameter_value, hyperparameter_specs) without return types