code: def write(path, data, kind="OTHER", dohex=False):
      assertType1(data)
      kind = kind.upper()
      try:
          os.remove(path)
      except os.error:
          pass
      err = 1
      try:
          if kind == "LWFN":
              writeLWFN(path, data)
          elif kind == "PFB":
              writePFB(path, data)
          else:
              writeOther(path, data, dohex)
          err = 0
      finally:
          if err and not DEBUG:
              try:
                  os.remove(path)
              except os.error:
                  pass
  
imports: import fontTools
  from fontTools.misc import eexec
  from fontTools.misc.macCreatorType import getMacCreatorAndType
  from fontTools.misc.textTools import bytechr, byteord, bytesjoin, tobytes
  from fontTools.misc.psOperators import _type1_pre_eexec_order, _type1_fontinfo_order, _type1_post_eexec_order
  from fontTools.encodings.StandardEncoding import StandardEncoding
  import os
  import re
label_desc: Use image node_id 2 for calling a global function with example usage: write(path, data, kind, dohex) without return types