def get_subclasses(cls):
    """
    Get all the (direct and indirect) subclasses of ``cls``.
    """
    subcls_set = {cls}
    for subcls in cls.__subclasses__():
        subcls_set.update(get_subclasses(subcls))
    return subcls_set