code: def sagemaker_session():
      boto_mock = Mock(name="boto_session", region_name=REGION)
      sms = Mock(
          name="sagemaker_session",
          boto_session=boto_mock,
          boto_region_name=REGION,
          config=None,
          local_mode=False,
          settings=SessionSettings(),
          default_bucket_prefix=None,
      )
      sms.default_bucket = Mock(
          name="default_bucket", return_value=BUCKET_NAME
      )
      sms.upload_data = Mock(
          name="upload_data", return_value=DEFAULT_S3_INPUT_DATA
      )
      sms.expand_role = Mock(name="expand_role", return_value=ROLE)
      sms.describe_auto_ml_job = Mock(
          name="describe_auto_ml_job",
          side_effect=describe_auto_ml_job_mock,
      )
      sms.sagemaker_client.describe_training_job = Mock(
          name="describe_training_job", return_value=TRAINING_JOB
      )
      sms.sagemaker_client.describe_transform_job = Mock(
          name="describe_transform_job", return_value=TRANSFORM_JOB
      )
      sms.list_candidates = Mock(
          name="list_candidates", return_value={"Candidates": []}
      )
      sms.sagemaker_client.list_tags = Mock(
          name="list_tags", return_value=LIST_TAGS_RESULT
      )
      # For tests which doesn't verify config file injection, operate with empty config
      sms.sagemaker_config = {}
      return sms
  
imports: from __future__ import absolute_import
  import copy
  import pytest
  from mock import Mock, patch
  from sagemaker import AutoML, AutoMLJob, AutoMLInput, CandidateEstimator, PipelineModel
  from sagemaker.predictor import Predictor
  from sagemaker.session_settings import SessionSettings
  from sagemaker.workflow.functions import Join
  from tests.unit import SAGEMAKER_CONFIG_AUTO_ML, SAGEMAKER_CONFIG_TRAINING_JOB, _test_default_bucket_and_prefix_combinations, DEFAULT_S3_BUCKET_NAME, DEFAULT_S3_OBJECT_KEY_PREFIX_NAME
label_desc: Use image node_id 2 for calling a global function with example usage: sagemaker_session() and returns: sms