We have a lot of boiler plate template code like
{% if config.interface is defined and config.interface.remote_as is defined and config.interface.remote_as is not none %} ... {% endif %}
This can be stripped down using a custom test to:
{% if config.interface.remote_as is vyos_defined %} ... {% endif %}
In addition the new vyos_defined test supports comparison
{% if foo.bar.baz is vyos_defined('zoo') %} ... {% endif %}
So the above will only evaluate to true if the variable foo.bar.baz is defined and its content is zoo
This is inspired from https://github.com/aristanetworks/ansible-avd/ which make heavy use of it.
All new templates should be written in this new style.