def load_oauth_datastore():
    datastore = getattr(settings, 'OAUTH_DATASTORE',
            'webmachine.auth.oauth_store.DataStore')
    i = datastore.rfind('.')
    module, clsname = datastore[:i], datastore[i+1:]
    try:
        mod = import_module(module)
    except ImportError:
        raise ImproperlyConfigured("oauth datastore module '%s' isn't valid" % module)

    try:
        cls = getattr(mod, clsname)
    except AttributeError:
        raise ImproperlyConfigured("oauth datastore '%s' doesn't exist in '%s' module" % (clsname, module))
    return cls
dataset/ETHPy150Open benoitc/dj-webmachine/webmachine/auth/oauth.py/load_oauth_datastore/original