def install_layout(cls, k, layout_class, **options):
    # if str(cls) == 'courses.Pupils':
    #     print("20160329 install_layout", k, layout_class)
    dl = cls.__dict__.get(k, None)
    if dl is None:  # and not cls._class_init_done:
        dl = getattr(cls, k)
    if dl is None:
        return
    if isinstance(dl, basestring):
        setattr(cls, k, layout_class(dl, cls, **options))
    elif isinstance(dl, layouts.Panel):
        options.update(dl.options)
        setattr(cls, k, layout_class(dl.desc, cls, **options))
    elif dl._datasource is None:
        dl.set_datasource(cls)
        setattr(cls, k, dl)
    elif not issubclass(cls, dl._datasource):
        raise Exception(
            "Cannot reuse %s instance (%s of %r) for %r" %
            (dl.__class__, k, dl._datasource, cls))
- `cls` is the actor (a class object)
dataset/ETHPy150Open lsaffre/lino/lino/core/actions.py/install_layout