code: def qapplication(translate=True, test_time=3):
      
      if running_in_mac_app():
          SpyderApplication = MacApplication
      else:
          SpyderApplication = QApplication
      
      app = SpyderApplication.instance()
      if app is None:
          # Set Application name for Gnome 3
          # https://groups.google.com/forum/#!topic/pyside/24qxvwfrRDs
          app = SpyderApplication(['Spyder'])
  
          # Set application name for KDE (See issue 2207)
          app.setApplicationName('Spyder')
      if translate:
          install_translator(app)
  
      test_ci = os.environ.get('TEST_CI_WIDGETS', None)
      if test_ci is not None:
          timer_shutdown = QTimer(app)
          timer_shutdown.timeout.connect(app.quit)
          timer_shutdown.start(test_time*1000)
      return app
docs: Return QApplication instance
      Creates it if it doesn't already exist
      
      test_time: Time to maintain open the application when testing. It's given
      in seconds