def set_driver(drivers, provider, module, klass):
 if (provider in drivers):
  raise AttributeError(('Provider %s already registered' % provider))
 drivers[provider] = (module, klass)
 try:
  driver = get_driver(drivers, provider)
 except (ImportError, AttributeError):
  exp = sys.exc_info()[1]
  drivers.pop(provider)
  raise exp
 return driver

def set_driver ( drivers , provider , module , klass ) : if ( provider in drivers ) : raise AttributeError ( ( 'Provider %s already registered' % provider ) ) drivers [ provider ] = ( module , klass ) try : driver = get_driver ( drivers , provider ) except ( ImportError , AttributeError ) : exp = sys . exc_info ( ) [ 1 ] drivers . pop ( provider ) raise exp return driver
sets a driver .