Refactor getattr custom filter