import itertools


def get_flattened_subclasses(cls):
    """
    Returns all the given subclasses and their subclasses recursively for the given class
    :param cls: Class to check
    :type cls: Type
    :return: Flattened list of subclasses and their subclasses
    """
    classes = cls.__subclasses__()
    return list(itertools.chain(classes, *[get_flattened_subclasses(x) for x in classes]))