def importObject(objectName, base=None, finder=imp.find_module, loader=imp.load_module):
    """ Imports an object or module using a dot-separated path."""

    for name in objectName.split("."):
        if base:
            # First try to get the object as an attribute of the module
            child = getattr(base, name, NonExistent)
            if child is NonExistent:
                if isinstance(base, ModuleType):
                    base = _importFromModule(name, base, finder, loader)
                else:
                    raise ImportError("Unable to import %s" % objectName)
            else:
                base = child
                
        else:
            base = _importFromModule(name)
      
    return base
dataset/ETHPy150Open joehewitt/devon/devon/importing.py/importObject/original