Given a list of *tokens* and an *index* (representing the current position),
    returns the token string if it is a variable name that can be safely
    obfuscated.

    Returns '__skipline__' if the rest of the tokens on this line should be skipped.
    Returns '__skipnext__' if the next token should be skipped.

    If *ignore_length* is ``True``, even variables that are already a single
    character will be obfuscated (typically only used with the ``--nonlatin``
    option).

def obfuscatable_variable(tokens, index, ignore_length=False):
    """
    Given a list of *tokens* and an *index* (representing the current position),
    returns the token string if it is a variable name that can be safely
    obfuscated.

    Returns '__skipline__' if the rest of the tokens on this line should be skipped.
    Returns '__skipnext__' if the next token should be skipped.

    If *ignore_length* is ``True``, even variables that are already a single
    character will be obfuscated (typically only used with the ``--nonlatin``
    option).
    """
    tok = tokens[index]
    token_type = tok[0]
    token_string = tok[1]
    line = tok[4]
    if index > 0:
        prev_tok = tokens[index-1]
    else: # Pretend it's a newline (for simplicity)
        prev_tok = (54, '\n', (1, 1), (1, 2), '#\n')
    prev_tok_type = prev_tok[0]
    prev_tok_string = prev_tok[1]
    try:
        next_tok = tokens[index+1]
    except IndexError: # Pretend it's a newline
        next_tok = (54, '\n', (1, 1), (1, 2), '#\n')
    next_tok_string = next_tok[1]
    if token_string == "=":
        return '__skipline__'
    if token_type != tokenize.NAME:
        return None # Skip this token
    if token_string.startswith('__'):
        return None
    if next_tok_string == ".":
        if token_string in imported_modules:
            return None
    if prev_tok_string == 'import':
        return '__skipline__'
    if prev_tok_string == ".":
        return '__skipnext__'
    if prev_tok_string == "for":
        if len(token_string) > 2:
            return token_string
    if token_string == "for":
        return None
    if token_string in keyword_args.keys():
        return None
    if token_string in ["def", "class", 'if', 'elif', 'import']:
        return '__skipline__'
    if prev_tok_type != tokenize.INDENT and next_tok_string != '=':
        return '__skipline__'
    if not ignore_length:
        if len(token_string) < 3:
            return None
    if token_string in RESERVED_WORDS:
        return None
    return token_string