def obfuscate_variable(<EOL>tokens,<EOL>index,<EOL>replace,<EOL>replacement,<EOL>right_of_equal,<EOL>inside_parens,<EOL>inside_function):
def return_replacement(replacement):<EOL><INDENT>VAR_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 index > <NUM_LIT:0>:<EOL><INDENT>prev_tok = tokens[index-<NUM_LIT:1>]<EOL><DEDENT>else: <EOL><INDENT>prev_tok = (<NUM_LIT>, '<STR_LIT:\n>', (<NUM_LIT:1>, <NUM_LIT:1>), (<NUM_LIT:1>, <NUM_LIT:2>), '<STR_LIT>')<EOL><DEDENT>prev_tok_string = prev_tok[<NUM_LIT:1>]<EOL>try:<EOL><INDENT>next_tok = tokens[index+<NUM_LIT:1>]<EOL><DEDENT>except IndexError: <EOL><INDENT>next_tok = (<NUM_LIT>, '<STR_LIT:\n>', (<NUM_LIT:1>, <NUM_LIT:1>), (<NUM_LIT:1>, <NUM_LIT:2>), '<STR_LIT>')<EOL><DEDENT>if token_string == "<STR_LIT>":<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>if next_tok[<NUM_LIT:1>] == '<STR_LIT:.>':<EOL><INDENT>if token_string in imported_modules:<EOL><INDENT>return None<EOL><DEDENT><DEDENT>if token_string == "<STR_LIT:=>":<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>if token_string == "<STR_LIT:(>":<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>if token_string == "<STR_LIT:)>":<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>if token_string == "<STR_LIT:U+002C>":<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>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>return '<STR_LIT>' <EOL><DEDENT>if token_string == replace and prev_tok_string != '<STR_LIT:.>':<EOL><INDENT>if inside_function:<EOL><INDENT>if token_string not in keyword_args[inside_function]:<EOL><INDENT>if not right_of_equal:<EOL><INDENT>if not inside_parens:<EOL><INDENT>return return_replacement(replacement)<EOL><DEDENT>else:<EOL><INDENT>if next_tok[<NUM_LIT:1>] != '<STR_LIT:=>':<EOL><INDENT>return return_replacement(replacement)<EOL><DEDENT><DEDENT><DEDENT>elif not inside_parens:<EOL><INDENT>return return_replacement(replacement)<EOL><DEDENT>else:<EOL><INDENT>if next_tok[<NUM_LIT:1>] != '<STR_LIT:=>':<EOL><INDENT>return return_replacement(replacement)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>elif not right_of_equal:<EOL><INDENT>if not inside_parens:<EOL><INDENT>return return_replacement(replacement)<EOL><DEDENT>else:<EOL><INDENT>if next_tok[<NUM_LIT:1>] != '<STR_LIT:=>':<EOL><INDENT>return return_replacement(replacement)<EOL><DEDENT><DEDENT><DEDENT>elif right_of_equal and not inside_parens:<EOL><INDENT>return return_replacement(replacement)<EOL><DEDENT><DEDENT>
If the token string inside *tokens[index]* matches *replace*, return
*replacement*. *right_of_equal*, and *inside_parens* are used to determine
whether or not this token is safe to obfuscate.