code: def writeLWFN(path, data):
      # Res.FSpCreateResFile was deprecated in OS X 10.5
      Res.FSpCreateResFile(path, "just", "LWFN", 0)
      resRef = Res.FSOpenResFile(path, 2)  # write-only
      try:
          Res.UseResFile(resRef)
          resID = 501
          chunks = findEncryptedChunks(data)
          for isEncrypted, chunk in chunks:
              if isEncrypted:
                  code = 2
              else:
                  code = 1
              while chunk:
                  res = Res.Resource(
                      bytechr(code) + "\0" + chunk[: LWFNCHUNKSIZE - 2]
                  )
                  res.AddResource("POST", resID, "")
                  chunk = chunk[LWFNCHUNKSIZE - 2 :]
                  resID = resID + 1
          res = Res.Resource(bytechr(5) + "\0")
          res.AddResource("POST", resID, "")
      finally:
          Res.CloseResFile(resRef)
  
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 6 for calling a global function with example usage: writeLWFN(path, data) without return types