I have a nested list of Python strings, like this one:
l = [['a', 'b', 'c'], ['d', 'e', 'f']]
I would like to quickly test if a given string is equal to any of the strings in any of the sublists. I could write a function to flatten the list, but the test needs to happen in a time-critical portion of my program. Is there a faster or more elegant way to do this?