def obfuscate_unique(tokens, index, replace, replacement, *args):
def return_replacement(replacement):<EOL><INDENT>UNIQUE_REPLACEMENTS[replacement] = replace<EOL>return replacement<EOL><DEDENT>tok = tokens[index]<EOL>token_type = tok[<NUM_LIT:0>]<EOL>token_string = tok[<NUM_LIT:1>]<EOL>if token_type != tokenize.NAME:<EOL><INDENT>return None <EOL><DEDENT>if token_string == replace:<EOL><INDENT>return return_replacement(replacement)<EOL><DEDENT>
If the token string (a unique value anywhere) inside *tokens[index]*
matches *replace*, return *replacement*.

.. note::

    This function is only for replacing absolutely unique ocurrences of
    *replace* (where we don't have to worry about their position).