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

def _import_class_or_module(self, name, currmodule):

    try:
        (path, base) = class_sig_re.match(name).groups()
    except ValueError:
        raise InheritanceException(('Invalid    class    or    module    %r    specified    for    inheritance    diagram' % name))
    fullname = ((path or '') + base)
    path = ((path and path.rstrip('.')) or '')
    try:
        module = __import__(fullname)
        todoc = sys.modules[fullname]
    except ImportError:
        if (not path):
            if currmodule:
                path = currmodule
            else:
                raise InheritanceException(('Could    not    import    class    %r    specified    for    inheritance    diagram' % base))
        try:
            module = __import__(path)
            todoc = getattr(sys.modules[path], base)
        except (ImportError, AttributeError):
            raise InheritanceException(('Could    not    import    class    or    module    %r    specified    for    inheritance    diagram' % ((path + '.') + base)))
    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 InheritanceException(('%r    specified    for    inheritance    diagram    is    not    a    class    or    module' % name))
