def isNestedInstance(obj, cl):
    """ Test for sub-classes types
    I could not find a universal test

    Parameters
    ----------
    obj: object instance
        object to test

    cl: Class
        top level class to test

    returns
    -------
    r: bool
        True if obj is indeed an instance or subclass instance of cl
    """
    tree = [cl]
    if hasattr(cl, "__subclasses"):
        for k in cl.__subclasses():
            if hasattr(k, "__subclasses"):
                tree += k.__subclasses__()
    return issubclass(obj.__class__, tuple(tree))