removed unneeded assertion
replaced itertools.ifilter call with list comprehension