def _flatten(container):
if isinstance(container, string_types):<EOL><INDENT>container = [container]<EOL><DEDENT>for elem in container:<EOL><INDENT>if isinstance(elem, string_types) or is_filter_tuple(elem):<EOL><INDENT>yield elem<EOL><DEDENT>else:<EOL><INDENT>for elem2 in _flatten(elem):<EOL><INDENT>yield elem2<EOL><DEDENT><DEDENT><DEDENT>
Flatten arbitrary nested list of filters into a 1-D list