def select_provider(config_parser, working_set, type, name):
 try:
  entry_point = working_set.iter_entry_points(type, name).next()
 except StopIteration:
  raise Exception(('unknown %s provider: %r' % (type, name)))
 else:
  provider_cls = entry_point.load()
 if hasattr(provider_cls, 'config'):
  config_parser.add_spec(provider_cls.config)
 return provider_cls()

def select_provider ( config_parser , working_set , type , name ) : try : entry_point = working_set . iter_entry_points ( type , name ) . next ( ) except StopIteration : raise Exception ( ( 'unknown %s provider: %r' % ( type , name ) ) ) else : provider_cls = entry_point . load ( ) if hasattr ( provider_cls , 'config' ) : config_parser . add_spec ( provider_cls . config ) return provider_cls ( )
given a type and name return an instantiated provider .