'Return the models corresponding to ``model_names`` and all those
that inherit/inherits from them.'

def descendants(self, model_names, *kinds):

    assert all(((kind in ('_inherit', '_inherits')) for kind in kinds))
    funcs = [attrgetter((kind + '_children')) for kind in kinds]
    models = OrderedSet()
    queue = deque(model_names)
    while queue:
        model = self[queue.popleft()]
        models.add(model._name)
        for func in funcs:
            queue.extend(func(model))
    return models
