@classmethod
    def get_alias(cls, tablename, link):

        components = current.model.components

        table = cls.table(tablename)
        if not table:
            return None

        def get_alias(hooks, alias):
            for alias in hooks:
                hook = hooks[alias]
                if hook.linktable:
                    prefix, name = hook.linktable.split("_", 1)
                    if name == link:
                        return alias
            return None

        hooks = components.get(tablename, None)
        if hooks:
            alias = get_alias(hooks, link)
            if alias:
                return alias
        else:
            hooks = []

        supertables = cls.get_config(tablename, "super_entity")
        if supertables:
            if not isinstance(supertables, (list, tuple)):
                supertables = [supertables]
            for s in supertables:
                table = cls.table(s)
                if table is None:
                    continue
                hooks = components.get(table._tablename, [])
                if hooks:
                    alias = get_alias(hooks, link)
                    if alias:
                        return alias

        return None

    # -------------------------------------------------------------------------
    # Resource Methods
    # -------------------------------------------------------------------------
Find a component alias from the link table alias.
dataset/ETHPy150Open sahana/eden/modules/s3/s3model.py/S3Model.get_alias