Helper that can be used inside a state SLS,
    in order to get the term configuration given its name,
    under a certain filter uniquely identified by its name.

    filter_name
        The name of the filter.

    term_name
        The name of the term.

    pillar_key: ``acl``
        The root key of the whole policy config. Default: ``acl``.

    pillarenv
        Query the master to generate fresh pillar data on the fly,
        specifically from the requested pillar environment.

    saltenv
        Included only for compatibility with
        :conf_minion:`pillarenv_from_saltenv`, and is otherwise ignored.

def get_term_pillar(filter_name,
                    term_name,
                    pillar_key='acl',
                    pillarenv=None,
                    saltenv=None):
    '''
    Helper that can be used inside a state SLS,
    in order to get the term configuration given its name,
    under a certain filter uniquely identified by its name.

    filter_name
        The name of the filter.

    term_name
        The name of the term.

    pillar_key: ``acl``
        The root key of the whole policy config. Default: ``acl``.

    pillarenv
        Query the master to generate fresh pillar data on the fly,
        specifically from the requested pillar environment.

    saltenv
        Included only for compatibility with
        :conf_minion:`pillarenv_from_saltenv`, and is otherwise ignored.
    '''
    filter_pillar_cfg = get_filter_pillar(filter_name,
                                          pillar_key=pillar_key,
                                          pillarenv=pillarenv,
                                          saltenv=saltenv)
    term_pillar_cfg = filter_pillar_cfg.get('terms', [])
    term_opts = _lookup_element(term_pillar_cfg, term_name)
    return term_opts