How To Create A Filter In Python