def import_driver(drivers, preferred=None):
 if preferred:
  drivers = [preferred]
 for d in drivers:
  try:
   return __import__(d, None, None, ['x'])
  except ImportError:
   pass
 raise ImportError(('Unable to import ' + ' or '.join(drivers)))

def import_driver ( drivers , preferred = None ) : if preferred : drivers = [ preferred ] for d in drivers : try : return __import__ ( d , None , None , [ 'x' ] ) except ImportError : pass raise ImportError ( ( 'Unable to import ' + ' or ' . join ( drivers ) ) )
import the first available driver or preferred driver .