def subclasses(cls, _seen=None):
    """Generator to return all subclasses of a given class"""

    if _seen is None:
        _seen = set()

    for sub in cls.__subclasses__():
        if sub not in _seen:
            _seen.add(sub)
            yield sub
            for sub in subclasses(sub, _seen):
                yield sub
dataset/ETHPy150Open CybOXProject/python-cybox/cybox/test/dev.py/subclasses/original