def has_module(module_name, members=[]):
 try:
  mod = __import__(module_name, fromlist=members)
 except ImportError:
  return False
 for member in members:
  if (not hasattr(mod, member)):
   return False
 return True

def has_module ( module_name , members = [ ] ) : try : mod = __import__ ( module_name , fromlist = members ) except ImportError : return False for member in members : if ( not hasattr ( mod , member ) ) : return False return True
return true if module exists .