Make partition_filter work with iterable