def itersubclasses(cls, _seen=None):
    
    if not isinstance(cls, type):
        raise TypeError('itersubclasses must be called with '
                        'new-style classes, not %.100r' % cls)
    if _seen is None: _seen = set()
    try:
        subs = cls.__subclasses__()
    except TypeError: # fails only when cls is type
        subs = cls.__subclasses__(cls)
    for sub in subs:
        if sub not in _seen:
            _seen.add(sub)
            yield sub
            for sub in itersubclasses(sub, _seen):
                yield sub
itersubclasses(cls)
dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/expedient/common/extendable/inheritance.py/itersubclasses