code: def write_gif_with_image_io(
      clip, filename, fps=None, opt=0, loop=0, colors=None, logger="bar"
  ):
      """Writes the gif with the Python library ImageIO (calls FreeImage)."""
      if colors is None:
          colors = 256
      logger = proglog.default_bar_logger(logger)
  
      if not IMAGEIO_FOUND:
          raise ImportError(
              "Writing a gif with imageio requires ImageIO installed,"
              " with e.g. 'pip install imageio'"
          )
  
      if fps is None:
          fps = clip.fps
  
      quantizer = 0 if opt != 0 else "nq"
  
      writer = imageio.save(
          filename,
          duration=1.0 / fps,
          quantizer=quantizer,
          palettesize=colors,
          loop=loop,
      )
      logger(
          message="MoviePy - Building file %s with imageio." % filename
      )
  
      for frame in clip.iter_frames(
          fps=fps, logger=logger, dtype="uint8"
      ):
          writer.append_data(frame)
  
file_path: moviepy/moviepy/video/io/gif_writers.py
imports: import os
  import subprocess
  import numpy
  import proglog
  from moviepy.config import FFMPEG_BINARY, IMAGEMAGICK_BINARY
  from moviepy.decorators import requires_duration, use_clip_fps_by_default
  from moviepy.tools import cross_platform_popen_params, subprocess_call
  from moviepy.video.fx.loop import loop
label_desc: Use image node_id 3 for calling a global function with example usage: write_gif_with_image_io(clip, filename, fps, opt, loop, colors, logger) without return types