def import_name_or_class(name):
    """ Import an object as either a fully qualified, dotted name, """
    if isinstance(name, str):
        module_name, object_name = name.rsplit('.', 1)
        mod = __import__(module_name)
        components = name.split('.')
        for comp in components[1:]:
            mod = getattr(mod, comp)
        return mod
    else:
        return name
