def remap_name(name_generator, names, table=None):
out = "<STR_LIT>"<EOL>for name in names:<EOL><INDENT>if table and name in table[<NUM_LIT:0>].keys():<EOL><INDENT>replacement = table[<NUM_LIT:0>][name]<EOL><DEDENT>else:<EOL><INDENT>replacement = next(name_generator)<EOL><DEDENT>out += "<STR_LIT>" % (replacement, name)<EOL><DEDENT>return out<EOL>
Produces a series of variable assignments in the form of::

    <obfuscated name> = <some identifier>

for each item in *names* using *name_generator* to come up with the
replacement names.

If *table* is provided, replacements will be looked up there before
generating a new unique name.