code: def enable_gui(gui=None, app=None):
      
  
      if get_return_control_callback() is None:
          raise ValueError("A return_control_callback must be supplied as a reference before a gui can be enabled")
  
      guis = {GUI_NONE: clear_inputhook,
              GUI_OSX: enable_mac,
              GUI_TK: enable_tk,
              GUI_GTK: enable_gtk,
              GUI_WX: enable_wx,
              GUI_QT: enable_qt,
              GUI_QT4: enable_qt4,
              GUI_QT5: enable_qt5,
              GUI_GLUT: enable_glut,
              GUI_PYGLET: enable_pyglet,
              GUI_GTK3: enable_gtk3,
              }
      try:
          gui_hook = guis[gui]
      except KeyError:
          if gui is None or gui == '':
              gui_hook = clear_inputhook
          else:
              e = "Invalid GUI request %r, valid ones are:%s" % (gui, guis.keys())
              raise ValueError(e)
      return gui_hook(app)
docs: Switch amongst GUI input hooks by name.
  
      This is just a utility wrapper around the methods of the InputHookManager
      object.
  
      Parameters
      ----------
      gui : optional, string or None
        If None (or 'none'), clears input hook, otherwise it must be one
        of the recognized GUI names (see ``GUI_*`` constants in module).
  
      app : optional, existing application object.
        For toolkits that have the concept of a global app, you can supply an
        existing one.  If not given, the toolkit will be probed for one, and if
        none is found, a new one will be created.  Note that GTK does not have
        this concept, and passing an app if ``gui=="GTK"`` will raise an error.
  
      Returns
      -------
      The output of the underlying gui switch routine, typically the actual
      PyOS_InputHook wrapper object or the GUI toolkit app created, if there was
      one.