code: def get_sagemaker_session(returns_status):
      boto_mock = MagicMock(name="boto_session", region_name=REGION)
      client_mock = MagicMock()
      client_mock.describe_model_package = MagicMock(
          return_value={"ModelPackageStatus": returns_status}
      )
      client_mock.describe_endpoint = MagicMock(
          return_value={"EndpointStatus": returns_status}
      )
      ims = sagemaker.Session(
          boto_session=boto_mock, sagemaker_client=client_mock
      )
      ims.expand_role = Mock(return_value=EXPANDED_ROLE)
      return ims
  
file_path: sagemaker-python-sdk/tests/unit/test_exception_on_bad_status.py
imports: from __future__ import absolute_import
  import pytest
  from mock import Mock, MagicMock
  import sagemaker
  from sagemaker.session import _check_job_status
label_desc: Use image node_id 1 for calling a global function with example usage: get_sagemaker_session(returns_status) and returns: ims