code: def _write_packet(self, packet, sec=None, usec=None, caplen=None, wirelen=None):
          
          if caplen is None:
              caplen = len(packet)
          if wirelen is None:
              wirelen = caplen
          if sec is None or usec is None:
              t=time.time()
              it = int(t)
              if sec is None:
                  sec = it
              if usec is None:
                  usec = int(round((t-it)*1000000))
          self.f.write(struct.pack(self.endian+"IIII", sec, usec, caplen, wirelen))
          self.f.write(packet)
          if self.gz and self.sync:
              self.f.flush()
docs: writes a single packet to the pcap file