2to3: Apply `filter` fixes. Closes #3053.

Generally, this involves using list comprehension, or explicit list
construction as `filter` is an iterator in Python 3.