def setup_yaml_parser(): var = re.compile(r".*\$\{.*\}.*", re.VERBOSE) yaml.add_constructor('!env_var', _env_var_constructor) yaml.add_implicit_resolver('!env_var', var)