<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def filter(self, func):
 """Returns a packet list filtered by a truth function"""

        return self.__class__(list(filter(func,self.res)),
                              name="filtered %s"%self.listname)