code: def _packets_from_tshark_sync(self, packet_count=None, existing_process=None):
          
          # NOTE: This has code duplication with the async version, think about how to solve this
          tshark_process = existing_process or self.eventloop.run_until_complete(self._get_tshark_process())
          psml_structure, data = self.eventloop.run_until_complete(self._get_psml_struct(tshark_process.stdout))
          packets_captured = 0
  
          data = b''
          try:
              while True:
                  try:
                      packet, data = self.eventloop.run_until_complete(
                          self._get_packet_from_stream(tshark_process.stdout, data, psml_structure=psml_structure,
                                                       got_first_packet=packets_captured > 0))
  
                  except EOFError:
                      self._log.debug('EOF reached (sync)')
                      break
  
                  if packet:
                      packets_captured += 1
                      yield packet
                  if packet_count and packets_captured >= packet_count:
                      break
          finally:
              self.eventloop.run_until_complete(self._cleanup_subprocess(tshark_process))
docs: Returns a generator of packets.
          This is the sync version of packets_from_tshark. It wait for the completion of each coroutine and
           reimplements reading packets in a sync way, yielding each packet as it arrives.
  
          :param packet_count: If given, stops after this amount of packets is captured.