def import_module(dotted_path):
    """Import a module path like 'a.b.c' => c module"""
    mod = __import__(dotted_path, globals(), locals(), [])
    for name in dotted_path.split('.')[1:]:
        try:
            mod = getattr(mod, name)
        except AttributeError:
            raise AttributeError("Module %r has no attribute %r" % (mod, name))
    return mod