Walk the tree and detect invalid escape sequences.

def plugin(tree, file_tokens):
    """Walk the tree and detect invalid escape sequences."""
    for token in file_tokens:
        if token[0] != STRING:  # token[0] == token.type
            continue
        # token[1] == token.string # python 3
        invalid_sequence_match = invalid_escape_sequence_match(token[1])
        if invalid_sequence_match:
            yield (
                token[2][0],  # line_number
                token[2][1],  # offset
                'IES: invalid escape sequence %s' %
                invalid_sequence_match.group(1),  # text
                None  # check # unused
            )