code: def load_qt(api_options):
      """
      Attempt to import Qt, given a preference list
      of permissible bindings
  
      It is safe to call this function multiple times.
  
      Parameters
      ----------
      api_options : List of strings
          The order of APIs to try. Valid items are 'pyside', 'pyside2',
          'pyqt', 'pyqt5', 'pyqtv1' and 'pyqtdefault'
  
      Returns
      -------
      A tuple of QtCore, QtGui, QtSvg, QT_API
      The first three are the Qt modules. The last is the
      string indicating which module was loaded.
  
      Raises
      ------
      ImportError, if it isn't possible to import any requested
      bindings (either because they aren't installed, or because
      an incompatible library has already been installed)
      """
      loaders = {
          # Qt6
          QT_API_PYQT6: import_pyqt6,
          QT_API_PYSIDE6: import_pyside6,
          # Qt5
          QT_API_PYQT5: import_pyqt5,
          QT_API_PYSIDE2: import_pyside2,
          # Qt4
          QT_API_PYSIDE: import_pyside,
          QT_API_PYQT: import_pyqt4,
          QT_API_PYQTv1: partial(import_pyqt4, version=1),
          # default
          QT_API_PYQT_DEFAULT: import_pyqt6,
      }
  
      for api in api_options:
          if api not in loaders:
              raise RuntimeError(
                  "Invalid Qt API %r, valid values are: %s"
                  % (api, ", ".join(["%r" % k for k in loaders.keys()]))
              )
  
          if not can_import(api):
              continue
  
          # cannot safely recover from an ImportError during this
          result = loaders[api]()
          api = result[-1]  # changed if api = QT_API_PYQT_DEFAULT
          commit_api(api)
          return result
      else:
          # Clear the environment variable since it doesn't work.
          if "QT_API" in os.environ:
              del os.environ["QT_API"]
  
          raise ImportError(
              """
      Could not load requested Qt binding. Please ensure that
      PyQt4 >= 4.7, PyQt5, PyQt6, PySide >= 1.0.3, PySide2, or
      PySide6 is available, and only one is imported per session.
  
      Currently-imported Qt library:                              %r
      PyQt5 available (requires QtCore, QtGui, QtSvg, QtWidgets): %s
      PyQt6 available (requires QtCore, QtGui, QtSvg, QtWidgets): %s
      PySide2 installed:                                          %s
      PySide6 installed:                                          %s
      Tried to load:                                              %r
      """
              % (
                  loaded_api(),
                  has_binding(QT_API_PYQT5),
                  has_binding(QT_API_PYQT6),
                  has_binding(QT_API_PYSIDE2),
                  has_binding(QT_API_PYSIDE6),
                  api_options,
              )
          )
  
imports: import importlib.abc
  import sys
  import os
  import types
  from functools import partial, lru_cache
  import operator
label_desc: Use image node_id 12 for calling a global function with example usage: load_qt(api_options) and returns: result