def all_subclasses(cls):
    """Recursively find all subclasses of cls."""

    subclasses = []

    stack = [cls]
    while stack:
        cls = stack.pop()

        for c in cls.__subclasses__():
            subclasses.append(c)
            stack.append(c)

    return subclasses