def check_or_get_class(class_or_name, module_path=None, superclass=None):
    'Returns the class and checks if the class inherits :attr:`superclass`.\n\n    Args:\n        class_or_name: Name or full path to the class, or the class itself.\n        module_paths (list, optional): Paths to candidate modules to search\n            for the class. This is used if :attr:`class_or_name` is a string and\n            the class cannot be located solely based on :attr:`class_or_name`.\n            The first module in the list that contains the class\n            is used.\n        superclass (optional): A (list of) classes that the target class\n            must inherit.\n\n    Returns:\n        The target class.\n\n    Raises:\n        ValueError: If class is not found based on :attr:`class_or_name` and\n            :attr:`module_paths`.\n        TypeError: If class does not inherits :attr:`superclass`.\n    '
    class_ = class_or_name
    if is_str(class_):
        class_ = get_class(class_, module_path)
    if (superclass is not None):
        if (not issubclass(class_, superclass)):
            raise TypeError('A subclass of {} is expected. Got: {}'.format(superclass, class_))
    return class_
Returns the class and checks if the class inherits :attr:`superclass`.

Args:
    class_or_name: Name or full path to the class, or the class itself.
    module_paths (list, optional): Paths to candidate modules to search
        for the class. This is used if :attr:`class_or_name` is a string and
        the class cannot be located solely based on :attr:`class_or_name`.
        The first module in the list that contains the class
        is used.
    superclass (optional): A (list of) classes that the target class
        must inherit.

Returns:
    The target class.

Raises:
    ValueError: If class is not found based on :attr:`class_or_name` and
        :attr:`module_paths`.
    TypeError: If class does not inherits :attr:`superclass`.
def check_or_get_class(class_or_name, module_path=None, superclass=None):
    'Returns the class and checks if the class inherits :attr:`superclass`.\n\n    Args:\n        class_or_name: Name or full path to the class, or the class itself.\n        module_paths (list, optional): Paths to candidate modules to search\n            for the class. This is used if :attr:`class_or_name` is a string and\n            the class cannot be located solely based on :attr:`class_or_name`.\n            The first module in the list that contains the class\n            is used.\n        superclass (optional): A (list of) classes that the target class\n            must inherit.\n\n    Returns:\n        The target class.\n\n    Raises:\n        ValueError: If class is not found based on :attr:`class_or_name` and\n            :attr:`module_paths`.\n        TypeError: If class does not inherits :attr:`superclass`.\n    '
    class_ = class_or_name
    if is_str(class_):
        class_ = get_class(class_, module_path)
    if (superclass is not None):
        if (not issubclass(class_, superclass)):
            raise TypeError('A subclass of {} is expected. Got: {}'.format(superclass, class_))
    return class_