code: def write_multipage(
      arrays, filename, flags=0, keep_cache_in_memory=True
  ):
      """Write a list of (width, height) or (nchannels, width, height)
      arrays to a multipage greyscale, RGB, or RGBA image, with file type
      deduced from the filename.
  
      """
      ftype = _FI.FreeImage_GetFIFFromFilename(_bytestr(filename))
      if ftype == -1:
          raise ValueError(
              "mahotas.freeimage: cannot determine type of file %s"
              % filename
          )
      create_new = True
      read_only = False
      multibitmap = _FI.FreeImage_OpenMultiBitmap(
          ftype,
          _bytestr(filename),
          create_new,
          read_only,
          keep_cache_in_memory,
          0,
      )
      if not multibitmap:
          raise ValueError(
              "mahotas.freeimage: could not open %s "
              "for writing multi-page image." % filename
          )
      try:
          for array in arrays:
              bitmap, _ = _array_to_bitmap(array)
              _FI.FreeImage_AppendPage(multibitmap, bitmap)
              _FI.FreeImage_Unload(bitmap)
      finally:
          _FI.FreeImage_CloseMultiBitmap(multibitmap, flags)
  
imports: import sys
  import os
  import ctypes
  import ctypes.util
  import numpy
label_desc: Use image node_id 10 for calling a global function with example usage: write_multipage(arrays, filename, flags, keep_cache_in_memory) without return types