code: def temporary_file(content=None, mode=None, binary=False):
      tmpf, tmpfname = tempfile.mkstemp()
      os.close(tmpf)
  
      if mode is None:
          if content is None:
              mode = "rb"
          else:
              mode = "wb"
  
      tmpf = open(tmpfname, mode)
      if content is not None:
          if hasattr(content, "encode") and not binary:
              tmpf.write(dedent(content).encode("utf8"))
          else:
              tmpf.write(content)
  
      tmpf.close()
      yield tmpfname
      try:
          os.unlink(tmpfname)
      except Exception:
          # ignore exceptions; it happens sometimes on Windows in the CI environment
          # that it cannot remove the temporary file because another process (?) is
          # using it...
          pass
  
imports: import os
  import platform
  import tempfile
  from contextlib import contextmanager
  from textwrap import dedent
label_desc: Use image node_id 2 for calling a global function with example usage: temporary_file(content, mode, binary) without return types