(names)
try given list of modules and return that imports
try given list of modules and return that imports
try given list of modules and return that imports
def detect_java_comm(names):
    """try given list of modules and return that imports"""
    for name in names:
        try:
            mod = my_import(name)
            mod.SerialPort
            return mod
        except (ImportError, AttributeError):
            pass
    raise ImportError("No Java Communications API implementation found")
def detect_java_comm ( names ) : for name in names : try : mod = my_import ( name ) mod . SerialPort return mod except ( ImportError , AttributeError ) : pass raise ImportError ( "No Java Communications API implementation found" )