def genrepl(scope):
def repl(match):<EOL><INDENT>"""<STR_LIT>"""<EOL>name = match.group('<STR_LIT:name>')<EOL>value = lookup(name, scope=scope)<EOL>result = name.replace('<STR_LIT:.>', '<STR_LIT:_>')<EOL>scope[result] = value<EOL>return result<EOL><DEDENT>return repl<EOL>
Replacement function with specific scope.