code: def serialize_obj_to_s3(
      obj: Any,
      sagemaker_session: Session,
      s3_uri: str,
      hmac_key: str,
      s3_kms_key: str = None,
  ):
      """Serializes data object and uploads it to S3.
  
      Args:
          sagemaker_session (sagemaker.session.Session):
              The underlying Boto3 session which AWS service calls are delegated to.
          s3_uri (str): S3 root uri to which resulting serialized artifacts will be uploaded.
          s3_kms_key (str): KMS key used to encrypt artifacts uploaded to S3.
          hmac_key (str): Key used to calculate hmac-sha256 hash of the serialized obj.
          obj: object to be serialized and persisted
      Raises:
          SerializationError: when fail to serialize object to bytes.
      """
  
      _upload_payload_and_metadata_to_s3(
          bytes_to_upload=CloudpickleSerializer.serialize(obj),
          hmac_key=hmac_key,
          s3_uri=s3_uri,
          sagemaker_session=sagemaker_session,
          s3_kms_key=s3_kms_key,
      )
  
imports: from __future__ import absolute_import
  import dataclasses
  import json
  import io
  import sys
  import hmac
  import hashlib
  import pickle
  from typing import Any, Callable, Union
  import cloudpickle
  from tblib import pickling_support
  from sagemaker.remote_function.errors import ServiceError, SerializationError, DeserializationError
  from sagemaker.s3 import S3Downloader, S3Uploader
  from sagemaker.session import Session
  from ._custom_dispatch_table import dispatch_table
label_desc: Use image node_id 4 for calling a global function with example usage: serialize_obj_to_s3(obj, sagemaker_session, s3_uri, hmac_key, s3_kms_key) without return types