def models_by_base(base, toplevel_only=False):
    found = []
    for m in get_models():
        if issubclass(m, base):
            add = True
            if toplevel_only:
                for i, old in enumerate(found):
                    if issubclass(m, old):
                        add = False
                    elif issubclass(old, m):
                        found[i] = m
                        add = False
            if add:
                found.append(m)

    def f(a, b):
        return cmp(full_model_name(a), full_model_name(b))
    from functools import cmp_to_key
    found.sort(key=cmp_to_key(f))
    return found


# def app_labels():
#     return [p.app_name for p in settings.SITE.installed_plugins]
    # if AFTER17:
    #     from django.apps import get_app_configs
    #     return [a.models_module.__name__.split('.')[-2]
    #             for a in get_app_configs()]
    # else:
    #     from django.db.models import loading
    #     return [a.__name__.split('.')[-2] for a in loading.get_apps()]
Yields a list of installed models that are subclass of the given
dataset/ETHPy150Open lsaffre/lino/lino/core/utils.py/models_by_base