def load_widget(path):
    """Utily to import a custom widget module"""

    if not path:
        return

    index = path.rfind('.')
    module, attr = path[:index], path[index + 1:]

    try:
        mod = import_module(module)
        return getattr(mod, attr)
    except (ImportError, __HOLE__, AttributeError), e:
        raise ImproperlyConfigured(
            'Error importing widget {0}: "{1}"'.format(path, e))
dataset/ETHPy150Open callowayproject/django-stories/stories/utils.py/load_widget