def find_all_subclasses(cls):
            """Find all subclasses of a given class, including subclasses of subclasses."""
            subclasses = cls.__subclasses__()
            for subclass in subclasses:
                # Recursively find subclasses of the current subclass
                subclasses.extend(find_all_subclasses(subclass))
            return subclasses
Find all subclasses of a given class, including subclasses of subclasses.
metadrive/engine/core/engine_core.py