code: def write_file_or_filename(file, content, mode="w"):
      """Write content to file, whether file is a string, a pathlib Path or a
      file-like object"""
      if isinstance(file, str) or isinstance(file, pathlib.PurePath):
          with open(file, mode) as f:
              f.write(content)
      else:
          file.write(content)
  
file_path: vegafusion/python/vegafusion/vegafusion/save.py
imports: import json
  import pathlib
  from .renderer import spec_to_mime_bundle
label_desc: Use image node_id 5 for calling a global function with example usage: write_file_or_filename(file, content, mode) without return types