def _load_function(fully_qualified_name):
    i = fully_qualified_name.rfind('.')
    module, attr = fully_qualified_name[:i], fully_qualified_name[i+1:]
    try:
        mod = __import__(module, globals(), locals(), [attr])
    except ImportError, e:
        raise Exception, 'Error importing engagement function %s: "%s"' % (module, e)
    try:
        func = getattr(mod, attr)
    except AttributeError:
        raise Exception, 'Module "%s does not define a "%s" attribute' % (module, attr)
    return func
dataset/ETHPy150Open Miserlou/django-easy-split/easy_split/management/commands/update_experiment_reports.py/_load_function/original