Returns a packet list filtered by a truth function. This truth
        function has to take a packet as the only argument and return a boolean value.

def filter(self, func):
        """Returns a packet list filtered by a truth function. This truth
        function has to take a packet as the only argument and return a boolean value."""  # noqa: E501
        return self.__class__([x for x in self.res if func(x)],
                              name="filtered %s" % self.listname)