Change filter() to list(filter()) for python 3+