code: def get_tc_and_exp_config_from_job_env(
      environment: _RunEnvironment,
      sagemaker_session: Session,
  ) -> dict:
      """Retrieve an experiment config from the job environment.
  
      Args:
          environment (_RunEnvironment): The run environment object with job specific data.
          sagemaker_session (sagemaker.session.Session): Session object which
              manages interactions with Amazon SageMaker APIs and any other
              AWS services needed. If not specified, one is created using the
              default AWS configuration chain.
      """
      job_name = environment.source_arn.split("/")[-1]
      if (
          environment.environment_type
          == _EnvironmentType.SageMakerTrainingJob
      ):
          job_response = retry_with_backoff(
              callable_func=lambda: sagemaker_session.describe_training_job(
                  job_name
              ),
              num_attempts=4,
          )
      elif (
          environment.environment_type
          == _EnvironmentType.SageMakerProcessingJob
      ):
          job_response = retry_with_backoff(
              callable_func=lambda: sagemaker_session.describe_processing_job(
                  job_name
              ),
              num_attempts=4,
          )
      else:  # environment.environment_type == _EnvironmentType.SageMakerTransformJob
          job_response = retry_with_backoff(
              callable_func=lambda: sagemaker_session.describe_transform_job(
                  job_name
              ),
              num_attempts=4,
          )
  
      job_exp_config = job_response.get("ExperimentConfig", dict())
      from sagemaker.experiments.run import RUN_NAME
  
      if job_exp_config.get(RUN_NAME, None):
          return job_exp_config
      raise RuntimeError(
          "Not able to fetch RunName in ExperimentConfig of the sagemaker job. "
          "Please make sure the ExperimentConfig is correctly set."
      )
  
imports: from __future__ import absolute_import
  import logging
  import os
  import mimetypes
  import urllib
  from functools import wraps
  from typing import Optional
  from sagemaker import Session
  from sagemaker.apiutils import _utils
  from sagemaker.experiments._environment import _RunEnvironment, _EnvironmentType
  from sagemaker.experiments.trial_component import _TrialComponent
  from sagemaker.utilities.search_expression import Filter, Operator, SearchExpression
  from sagemaker.utils import retry_with_backoff
label_desc: Use image node_id 6 for calling a global function with example usage: get_tc_and_exp_config_from_job_env(environment, sagemaker_session) and returns: job_exp_config