def ensure_direct_subclass(class_, of):
    """Check whether given class is a direct subclass of another.

    :param class_: Class to check
    :param of: Superclass to check against

    :return: ``class_``, if the check succeeds
    :raise TypeError: When the check fails

    .. versionadded:: 0.0.4
    """
    if not is_direct_subclass(class_, of):
        raise TypeError("expected a direct subclass of %r, got %s instead" % (
            of, class_.__name__))
    return class_
def ensure_direct_subclass ( class_ , of ) : if not is_direct_subclass ( class_ , of ) : raise TypeError ( "expected a direct subclass of %r, got %s instead" % ( of , class_ . __name__ ) ) return class_
Check whether given class is a direct subclass of another.

    :param class_: Class to check
    :param of: Superclass to check against

    :return: ``class_``, if the check succeeds
    :raise TypeError: When the check fails

    .. versionadded:: 0.0.4