code: def find_gui_and_backend():
      
      matplotlib = sys.modules['matplotlib']
      # WARNING: this assumes matplotlib 1.1 or newer!!
      backend = matplotlib.rcParams['backend']
      # In this case, we need to find what the appropriate gui selection call
      # should be for IPython, so we can activate inputhook accordingly
      gui = backend2gui.get(backend, None)
      return gui, backend
docs: Return the gui and mpl backend.