Parser functions should be declared in modules
see: https://docs.puppetlabs.com/guides/custom_functions.html