def write(self, pkt):
        """
        Writes a Packet or bytes to a pcap file.

        :param pkt: Packet(s) to write (one record for each Packet), or raw
                    bytes to write (as one record).
        :type pkt: iterable[Packet], Packet or bytes
        """
        if isinstance(pkt, bytes):
            if not self.header_present:
                self._write_header(pkt)
            self._write_packet(pkt)
        else:
            pkt = pkt.__iter__()
            for p in pkt:
                if not self.header_present:
                    self._write_header(p)
                self._write_packet(p)
def write ( self , pkt ) : if isinstance ( pkt , bytes ) : if not self . header_present : self . _write_header ( pkt ) self . _write_packet ( pkt ) else : pkt = pkt . __iter__ ( ) for p in pkt : if not self . header_present : self . _write_header ( p ) self . _write_packet ( p )
Writes a Packet or bytes to a pcap file.

        :param pkt: Packet(s) to write (one record for each Packet), or raw
                    bytes to write (as one record).
        :type pkt: iterable[Packet], Packet or bytes