'Import a class using its fully-qualified *name*.'

def _import_class_or_module(self, name):

    try:
        (path, base) = self.py_sig_re.match(name).groups()
    except:
        raise ValueError(("Invalid    class    or    module    '%s'    specified    for    inheritance    diagram" % name))
    fullname = ((path or '') + base)
    path = (path and path.rstrip('.'))
    if (not path):
        path = base
    try:
        module = __import__(path, None, None, [])
        my_import(fullname)
    except ImportError:
        raise ValueError(("Could    not    import    class    or    module    '%s'    specified    for    inheritance    diagram" % name))
    try:
        todoc = module
        for comp in fullname.split('.')[1:]:
            todoc = getattr(todoc, comp)
    except AttributeError:
        raise ValueError(("Could    not    find    class    or    module    '%s'    specified    for    inheritance    diagram" % name))
    if inspect.isclass(todoc):
        return [todoc]
    elif inspect.ismodule(todoc):
        classes = []
        for cls in todoc.__dict__.values():
            if (inspect.isclass(cls) and (cls.__module__ == todoc.__name__)):
                classes.append(cls)
        return classes
    raise ValueError(("'%s'    does    not    resolve    to    a    class    or    module" % name))
