def replace_pattern(tokens, new_pattern):
    for state in tokens.values():
        for index, pattern in enumerate(state):
            if isinstance(pattern, tuple) and pattern[1] == new_pattern[1]:
                state[index] = new_pattern

# More monkeypatching!
A *NoAttrs* instance replacing the typical *AttributeSet* instance of
dataset/ETHPy150Open OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/pyqode/core/modes/pygments_sh.py/replace_pattern--crossover with--dataset/ETHPy150Open PyTables/PyTables/tables/link.py/Link._v_attrs