code: def _fetch_from_ssm(key: str, test_name: str | None = None) -> str:
      """
      Test values are stored in the SSM Value as a JSON-encoded dict of key/value pairs.
  
      :param key: The key to search for within the returned Parameter Value.
      :return: The value of the provided key from SSM
      """
      _test_name: str = test_name or _get_test_name()
      hook = SsmHook(aws_conn_id=None)
      value: str = ""
  
      try:
          value = json.loads(hook.get_parameter_value(_test_name))[key]
      # Since a default value after the SSM check is allowed, these exceptions should not stop execution.
      except NoCredentialsError as e:
          log.info("No boto credentials found: %s", e)
      except ClientError as e:
          log.info("Client error when connecting to SSM: %s", e)
      except hook.conn.exceptions.ParameterNotFound as e:
          log.info(
              "SSM does not contain any parameter for this test: %s", e
          )
      except KeyError as e:
          log.info(
              "SSM contains one parameter for this test, but not the requested value: %s",
              e,
          )
      return value
  
imports: from __future__ import annotations
  import inspect
  import json
  import logging
  import os
  import time
  from pathlib import Path
  from typing import TYPE_CHECKING
  from uuid import uuid4
  import boto3
  from botocore.exceptions import ClientError, NoCredentialsError
  from airflow.decorators import task
  from airflow.providers.amazon.aws.hooks.ssm import SsmHook
  from airflow.utils.state import State
  from airflow.utils.trigger_rule import TriggerRule
label_desc: Use image node_id 3 for calling a global function with example usage: _fetch_from_ssm(key, test_name) and returns: value