code: def test_ipython_display(
      util,
      clip,
      filetype,
      fps,
      maxduration,
      t,
      expected_error,
      monkeypatch,
  ):
      # patch module to use it without ipython installed
      video_io_html_tools_module = importlib.import_module(
          "moviepy.video.io.html_tools"
      )
      monkeypatch.setattr(
          video_io_html_tools_module, "ipython_available", True
      )
  
      # build `ipython_display` kwargs
      kwargs = {}
      if fps is not None:
          kwargs["fps"] = fps
      if maxduration is not None:
          kwargs["maxduration"] = maxduration
      if t is not None:
          kwargs["t"] = t
  
      if isinstance(clip, str):
          clip = clip.replace("{tempdir}", util.TMP_DIR)
  
      if expected_error is None:
          html_content = video_io_html_tools_module.ipython_display(
              clip,
              rd_kwargs=dict(logger=None),
              filetype=filetype,
              **kwargs,
          )
      else:
          with pytest.raises(expected_error[0]) as exc:
              video_io_html_tools_module.ipython_display(
                  clip,
                  rd_kwargs=None if not kwargs else dict(logger=None),
                  filetype=filetype,
                  **kwargs,
              )
          assert expected_error[1] in str(exc.value)
          return
  
      # assert built content according to each file type
      HTML5_support_message = "Sorry, seems like your browser doesn't support HTML5 audio/video"
  
      def image_contents():
          return ("<div align=middle><img  src=", "></div>")
  
      if isinstance(clip, AudioClip):
          content_start = (
              "<div align=middle><audio controls><source   src="
          )
          content_end = f">{HTML5_support_message}</audio></div>"
      elif (
          isinstance(clip, ImageClip) or t is not None
      ):  # t -> ImageClip
          content_start, content_end = image_contents()
      elif isinstance(clip, VideoClip):
          content_start = "<div align=middle><video src="
          content_end = (
              f" controls>{HTML5_support_message}</video></div>"
          )
      else:
          ext = os.path.splitext(clip)[1]
          if ext in [".jpg", ".gif"]:
              content_start, content_end = image_contents()
          else:
              raise NotImplementedError(
                  f"'test_ipython_display' must handle '{ext}' extension types!"
              )
  
      assert html_content.startswith(content_start)
      assert html_content.endswith(content_end)
  
      # clean `ipython` and `moviepy.video.io.html_tools` module from cache
      del sys.modules["moviepy.video.io.html_tools"]
      if "ipython" in sys.modules:
          del sys.modules["ipython"]
  
imports: import importlib
  import math
  import os
  import shutil
  import sys
  import numpy
  import pytest
  from moviepy.audio.AudioClip import AudioClip, CompositeAudioClip
  from moviepy.audio.fx.multiply_volume import multiply_volume
  from moviepy.audio.tools.cuts import find_audio_period
  from moviepy.video.compositing.concatenate import concatenate_videoclips
  from moviepy.video.fx.loop import loop
  from moviepy.video.fx.time_mirror import time_mirror
  from moviepy.video.io.VideoFileClip import VideoFileClip
  from moviepy.video.tools.credits import CreditsClip
  from moviepy.video.tools.cuts import FramesMatch, FramesMatches, detect_scenes, find_video_period
  from moviepy.video.tools.drawing import circle, color_gradient, color_split
  from moviepy.video.tools.interpolators import Interpolator, Trajectory
  from moviepy.video.VideoClip import BitmapClip, ColorClip, ImageClip, VideoClip
label_desc: Use image node_id 18 for calling a global function with example usage: test_ipython_display(util, clip, filetype, fps, maxduration, t, expected_error, monkeypatch) and returns: str,  str