from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module

def get_backend():
    """
    Return an instance of the registration backend for use on this
    site, as determined by the ``REGISTRATION_BACKEND`` setting. Raise
    ``django.core.exceptions.ImproperlyConfigured`` if the specified
    backend cannot be located.
    
    """
    i = settings.REGISTRATION_BACKEND.rfind('.')
    module, attr = settings.REGISTRATION_BACKEND[:i], settings.REGISTRATION_BACKEND[i+1:]
    try:
        mod = import_module(module)
    except ImportError, e:
        raise ImproperlyConfigured('Error loading registration backend %s: "%s"' % (module, e))
    try:
        backend_class = getattr(mod, attr)
    except AttributeError:
        raise ImproperlyConfigured('Module "%s" does not define a registration backend named "%s"' % (module, attr))
    return backend_class()

Add utility function for retrieving the active registration backend.
Add utility function for retrieving the active registration backend.
