code: def save_file(obj: Any, path: str):
      if path.endswith(".json"):
          with fsspec.open(path, "w") as f:
              json.dump(obj, f, indent=4)
      elif path.endswith(".pth"):
          with fsspec.open(path, "wb") as f:
              torch.save(obj, f)
      else:
          raise ValueError("Unsupported file type")
  
imports: import json
  import random
  from typing import Any, Dict, List, Tuple, Union
  import fsspec
  import numpy
  import torch
  from TTS.config import load_config
  from TTS.encoder.utils.generic_utils import setup_encoder_model
  from TTS.utils.audio import AudioProcessor
label_desc: Use image node_id 2 for calling a global function with example usage: save_file(obj, path) without return types