code: def has_binding(api):
      """Safely check for PyQt4/5, PySide or PySide2, without importing submodules
  
      Supports Python <= 3.3
  
         Parameters
         ----------
         api : str [ 'pyqtv1' | 'pyqt' | 'pyqt5' | 'pyside' | 'pyside2' | 'pyqtdefault']
              Which module to check for
  
         Returns
         -------
         True if the relevant module appears to be importable
      """
      # we can't import an incomplete pyside and pyqt4
      # this will cause a crash in sip (#1431)
      # check for complete presence before importing
      module_name = api_to_module[api]
  
      import imp
  
      try:
          # importing top level PyQt4/PySide module is ok...
          mod = __import__(module_name)
          # ...importing submodules is not
          imp.find_module("QtCore", mod.__path__)
          imp.find_module("QtGui", mod.__path__)
          imp.find_module("QtSvg", mod.__path__)
          if api in (QT_API_PYQT5, QT_API_PYSIDE2):
              # QT5 requires QtWidgets too
              imp.find_module("QtWidgets", mod.__path__)
  
          # we can also safely check PySide version
          if api == QT_API_PYSIDE:
              return check_version(mod.__version__, "1.0.3")
          else:
              return True
      except ImportError:
          return False
  
imports: import sys
  import types
  from functools import partial
  from IPython.utils.version import check_version
label_desc: Use image node_id 3 for calling a global function with example usage: has_binding(api) and returns: check_version, True, False