code: def test_handle_error(
      exists,
      mock_open_file,
      serialize_exception_to_s3,
      sagemaker_session,
      error,
      expected_exit_code,
      error_string,
  ):
      err = error
      exit_code = handle_error(
          error=err,
          sagemaker_session=sagemaker_session,
          s3_base_uri=TEST_S3_BASE_URI,
          s3_kms_key=TEST_S3_KMS_KEY,
          hmac_key=TEST_HMAC_KEY,
      )
  
      assert exit_code == expected_exit_code
      exists.assert_called_once_with("/opt/ml/output/failure")
      mock_open_file.assert_called_with("/opt/ml/output/failure", "w")
      mock_open_file.return_value.__enter__().write.assert_called_with(
          error_string
      )
      serialize_exception_to_s3.assert_called_with(
          exc=err,
          sagemaker_session=sagemaker_session,
          s3_uri=TEST_S3_BASE_URI + "exception",
          hmac_key=TEST_HMAC_KEY,
          s3_kms_key=TEST_S3_KMS_KEY,
      )
  
file_path: sagemaker-python-sdk/tests/unit/sagemaker/remote_function/test_errors.py
imports: from __future__ import absolute_import
  import pytest
  import errno
  from mock import patch, Mock, mock_open
  from sagemaker.remote_function.errors import SerializationError, handle_error
label_desc: Use image node_id 2 for calling a global function with example usage: test_handle_error(exists, mock_open_file, serialize_exception_to_s3, sagemaker_session, error, expected_exit_code, error_string) without return types