code: def test_load_and_invoke_json_serialization(
      deserialize_func,
      deserialize_obj,
      json_serialize_obj,
      serialize_output_to_json,
  ):
      session = Mock()
      s3_base_uri = "s3://base_uri/"
  
      stored_function = StoredFunction(
          sagemaker_session=session,
          s3_base_uri=s3_base_uri,
          s3_kms_key=KMS_KEY,
          hmac_key=HMAC_KEY,
          context=Context(
              serialize_output_to_json=serialize_output_to_json,
          ),
      )
  
      stored_function.load_and_invoke()
  
      result = deserialize_func.return_value(
          *deserialize_obj.return_value[0],
          **deserialize_obj.return_value[1],
      )
  
      if serialize_output_to_json:
          json_serialize_obj.assert_called_once_with(
              obj=result,
              json_key=JSON_SERIALIZED_RESULT_KEY,
              sagemaker_session=session,
              s3_uri=(s3_base_uri + RESULT_FOLDER + "/results.json"),
              s3_kms_key=KMS_KEY,
          )
      else:
          json_serialize_obj.assert_not_called()
  
imports: from __future__ import absolute_import
  import pytest
  import random
  import string
  from mock import MagicMock, Mock, patch
  from sagemaker.experiments.experiment import Experiment
  from sagemaker.experiments.run import Run
  from sagemaker.experiments.trial import _Trial
  from sagemaker.experiments.trial_component import _TrialComponent
  from sagemaker.remote_function.core.stored_function import StoredFunction, JSON_SERIALIZED_RESULT_KEY, _SerializedData
  from sagemaker.remote_function.core.serialization import deserialize_obj_from_s3, serialize_obj_to_s3, CloudpickleSerializer
  from sagemaker.remote_function.core.pipeline_variables import Context, convert_pipeline_variables_to_pickleable
  from sagemaker.remote_function.errors import SerializationError
  from sagemaker.workflow.function_step import _FunctionStep, DelayedReturn
  from sagemaker.workflow.parameters import ParameterFloat
  from sagemaker.utils import sagemaker_timestamp
  from tests.unit.sagemaker.experiments.helpers import TEST_EXP_DISPLAY_NAME, TEST_EXP_NAME, TEST_RUN_DISPLAY_NAME, TEST_RUN_NAME, mock_tc_load_or_create_func, mock_trial_load_or_create_func
label_desc: Use image node_id 10 for calling a global function with example usage: test_load_and_invoke_json_serialization(deserialize_func, deserialize_obj, json_serialize_obj, serialize_output_to_json) without return types