code: def get_app_qt4(*args, **kwargs):
      """Create a new qt4 app or return an existing one."""
      from IPython.external.qt_for_kernel import QtGui
  
      app = QtGui.QApplication.instance()
      if app is None:
          if not args:
              args = ([""],)
          app = QtGui.QApplication(*args, **kwargs)
      return app
  
imports: from IPython.core.getipython import get_ipython
label_desc: Use image node_id 4 for calling a global function with example usage: get_app_qt4() and returns: app