def obfuscate_class(tokens, index, replace, replacement, *args):
def return_replacement(replacement):<EOL><INDENT>CLASS_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>prev_tok = tokens[index-<NUM_LIT:1>]<EOL>prev_tok_string = prev_tok[<NUM_LIT:1>]<EOL>if token_type != tokenize.NAME:<EOL><INDENT>return None <EOL><DEDENT>if token_string.startswith('<STR_LIT>'):<EOL><INDENT>return None<EOL><DEDENT>if prev_tok_string != '<STR_LIT:.>':<EOL><INDENT>if token_string == replace:<EOL><INDENT>return return_replacement(replacement)<EOL><DEDENT><DEDENT>
If the token string (a class) inside *tokens[index]* matches *replace*,
return *replacement*.