code: def create_sagemaker_session(
      describe_training_result=None,
      list_training_results=None,
      metric_stats_results=None,
      describe_tuning_result=None,
  ):
      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.sagemaker_client.describe_hyper_parameter_tuning_job = Mock(
          name="describe_hyper_parameter_tuning_job",
          return_value=describe_tuning_result,
      )
      sms.sagemaker_client.describe_training_job = Mock(
          name="describe_training_job",
          return_value=describe_training_result,
      )
      sms.sagemaker_client.list_training_jobs_for_hyper_parameter_tuning_job = Mock(
          name="list_training_jobs_for_hyper_parameter_tuning_job",
          return_value=list_training_results,
      )
      cwm_mock = Mock(name="cloudwatch_client")
      boto_mock.client = Mock(return_value=cwm_mock)
      cwm_mock.get_metric_statistics = Mock(
          name="get_metric_statistics"
      )
      cwm_mock.get_metric_statistics.side_effect = (
          cw_request_side_effect
      )
      return sms
  
imports: from __future__ import absolute_import
  import datetime
  import os
  import uuid
  import pytest
  from mock import Mock
  from sagemaker.analytics import AnalyticsMetricsBase, HyperparameterTuningJobAnalytics, TrainingJobAnalytics
  from sagemaker.session_settings import SessionSettings
label_desc: Use image node_id 2 for calling a global function with example usage: create_sagemaker_session(describe_training_result, list_training_results, metric_stats_results, describe_tuning_result) and returns: sms