code: def apply_on_packets(self, callback, timeout=None, packet_count=None):
          
          coro = self.packets_from_tshark(callback, packet_count=packet_count)
          if timeout is not None:
              coro = asyncio.wait_for(coro, timeout)
          return self.eventloop.run_until_complete(coro)
docs: Runs through all packets and calls the given callback (a function) with each one as it is read.
          If the capture is infinite (i.e. a live capture), it will run forever, otherwise it will complete after all
          packets have been read.
  
          Example usage:
          def print_callback(pkt):
              print(pkt)
          capture.apply_on_packets(print_callback)
  
          If a timeout is given, raises a Timeout error if not complete before the timeout (in seconds)