def _recurse_on_subclasses(klass):
    """Return as a set all subclasses in a classes' subclass
    hierarchy."""
    return set(klass.__subclasses__()).union(
        [
            sub
            for cls in klass.__subclasses__()
            for sub in _recurse_on_subclasses(cls)
        ]
    )