code: def has_binding(api):
      
      # 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 = {QT_API_PYSIDE: 'PySide',
                     QT_API_PYQT: 'PyQt4',
                     QT_API_PYQTv1: 'PyQt4',
                     QT_API_PYQT_DEFAULT: 'PyQt4',
                     QT_API_PYQT5: 'PyQt5',
                     }
      module_name = module_name[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__)
  
          #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
docs: Safely check for PyQt4 or PySide, without importing
         submodules
  
         Parameters
         ----------
         api : str [ 'pyqtv1' | 'pyqt' | 'pyside' | 'pyqtdefault']
              Which module to check for
  
         Returns
         -------
         True if the relevant module appears to be importable