def load_library(lib, name=None, lib_cls=None):
 try:
  if lib_cls:
   return lib_cls(lib)
  else:
   return ctypes.CDLL(lib)
 except Exception:
  if name:
   lib_msg = ('%s (%s)' % (name, lib))
  else:
   lib_msg = lib
  lib_msg += ' could not be loaded'
  if (sys.platform == 'cygwin'):
   lib_msg += ' in cygwin'
  _LOGGER.error(lib_msg, exc_info=True)
  return None

def load_library ( lib , name = None , lib_cls = None ) : try : if lib_cls : return lib_cls ( lib ) else : return ctypes . CDLL ( lib ) except Exception : if name : lib_msg = ( '%s (%s)' % ( name , lib ) ) else : lib_msg = lib lib_msg += ' could not be loaded' if ( sys . platform == 'cygwin' ) : lib_msg += ' in cygwin' _LOGGER . error ( lib_msg , exc_info = True ) return None
loads a library .