def load_class(class_path, superclass=None, prefix_hints=[]):
    module_or_class = locate_with_hint(class_path, prefix_hints)
    if module_or_class is None:
        raise ValueError("Cannot find module or class under path %s" % class_path)
    if type(module_or_class) == types.ModuleType:
        if superclass:
            classes = filter(lambda x: issubclass(x, superclass), classesinmodule(module_or_class))
        if len(classes) == 0:
            if superclass:
                raise ValueError('Could not find any subclasses of %s defined in module %s' % (str(superclass), class_path))
            else:
                raise ValueError('Could not find any classes defined in module %s' % (class_path))
        elif len(classes) > 1:
            if superclass:
                raise ValueError('Multiple subclasses of %s are defined in the module %s' % (str(superclass), class_path))
            else:
                raise ValueError('Multiple classes are defined in the module %s' % (class_path))
        else:
            return classes[0]
    elif isinstance(module_or_class, type):
        if superclass is None or issubclass(module_or_class, superclass):
            return module_or_class
        else:
            raise ValueError('The class %s is not a subclass of %s' % (str(module_or_class), str(superclass)))
    else:
        raise ValueError('Unsupported object: %s' % str(module_or_class))
dataset/ETHPy150Open rllab/rllab/rllab/misc/resolve.py/load_class/original