code: def save(path, obj, sanitize=True):
      if sanitize:
          obj = sanitize_object_to_primitives(obj=obj)
      is_s3_path = s3_utils.is_s3_url(path)
      if is_s3_path:
          import boto3
  
          data = json.dumps(obj).encode("UTF-8")
  
          bucket, key = s3_utils.s3_path_to_bucket_prefix(path)
          s3_client = boto3.client("s3")
          s3_client.put_object(Body=data, Bucket=bucket, Key=key)
      else:
          dirname = os.path.dirname(path)
          if dirname:
              os.makedirs(dirname, exist_ok=True)
          with open(path, "w") as fp:
              json.dump(obj, fp, indent=2)
  
imports: import json
  import logging
  import os
  import tempfile
  from ..utils import s3_utils
label_desc: Use image node_id 1 for calling a global function with example usage: save(path, obj, sanitize) without return types