Is anyone aware of any prior work done with searching or matching a pattern over nested Python lists? I have this problem where I have a list like: [1, 2, [1, 2, [1, 7], 9, 9], 10] and I'd like to search for the pattern [1, 2, ANY] so that is returns: [1, 2, [1, 2, [6, 7], 9, 9], 10] [1, 2, [6, 7], 9, 9]