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!
Test that a summary is stored under the correct key and most
dataset/ETHPy150Open enthought/pyface/pyface/ui/qt4/code_editor/pygments_highlighter.py/replace_pattern--crossover with--dataset/ETHPy150Open pympler/pympler/test/muppy/test_tracker.py/TrackerTest.test_stracker_store_summary