def import_string(dotted_path, error_prefix=''):
            try:
                module_path, class_name = dotted_path.rsplit('.', 1)
            except ValueError:
                raise ImproperlyConfigured("%s%s doesn't look like a module path" % (
                    error_prefix, dotted_path))
            try:
                module = import_module(module_path)
            except __HOLE__ as e:
                msg = '%sError importing module %s: "%s"' % (
                    error_prefix, module_path, e)
                six.reraise(ImproperlyConfigured, ImproperlyConfigured(msg),
                            sys.exc_info()[2])
            try:
                attr = getattr(module, class_name)
            except AttributeError:
                raise ImproperlyConfigured('%sModule "%s" does not define a "%s" attribute/class' % (
                    error_prefix, module_path, class_name))
            return attr
dataset/ETHPy150Open mwarkentin/django-watchman/watchman/utils.py/import_string