def __replace(config, wildcards, config_file):
for config_key in config:<EOL><INDENT>config_value = config[config_key]<EOL>original_value = config_value<EOL>if isinstance(config_value, str):<EOL><INDENT>for token in wildcards:<EOL><INDENT>if wildcards[token]:<EOL><INDENT>config_value = config_value.replace(token, wildcards[token])<EOL><DEDENT><DEDENT>found = re.findall(r'<STR_LIT>', config_value)<EOL>if found:<EOL><INDENT>raise ValueError("<STR_LIT>" %<EOL>(config_key, original_value, config_file, "<STR_LIT:U+002CU+0020>".join(found)))<EOL><DEDENT>config[config_key] = config_value<EOL><DEDENT><DEDENT>return config<EOL>
For each kvp in config, do wildcard substitution on the values