Make methods not depending on the instance static
Don't shadow built-in name, filter
Use augmented assignment statements where appropriate