Update filtering.py

python 3 style raise exceptions.