def METHOD_NAME(
    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."
    )