code: def enable_gui(gui, kernel=None):
      """Enable integration with a given GUI"""
      if gui not in loop_map:
          e = "Invalid GUI request %r, valid ones are:%s" % (
              gui,
              loop_map.keys(),
          )
          raise ValueError(e)
      if kernel is None:
          if Application.initialized():
              kernel = getattr(Application.instance(), "kernel", None)
          if kernel is None:
              raise RuntimeError(
                  "You didn't specify a kernel,"
                  " and no IPython Application with a kernel appears to be running."
              )
      loop = loop_map[gui]
      if (
          loop
          and kernel.eventloop is not None
          and kernel.eventloop is not loop
      ):
          raise RuntimeError("Cannot activate multiple GUI eventloops")
      kernel.eventloop = loop
  
imports: import os
  import sys
  import platform
  import zmq
  from distutils.version import LooseVersion
  from traitlets.config.application import Application
  from IPython.utils import io
label_desc: Use image node_id 22 for calling a global function with example usage: enable_gui(gui, kernel) without return types