docs: def write (self, bytes, header=None):
          """Writes packet ``bytes`` and the optional pcap packet ``header``.
  
          If the pcap packet ``header`` is not specified, one will be
          generated based on the number of packet ``bytes`` and current
          time.
          """
          if header is None:
              header = PCapPacketHeader(orig_len=len(bytes))
  
          if self._stream is None:
              if self._threshold.nseconds is not None:
                  # Round down to the nearest multiple of nseconds
                  nseconds  = self._threshold.nseconds
                  remainder = int( math.floor( header.ts % nseconds ) )
                  delta     = datetime.timedelta(seconds=remainder)
                  timestamp = header.timestamp - delta
              else:
                  timestamp = header.timestamp
  
              self._filename  = timestamp.strftime(self._format)
              self._startTime = calendar.timegm(
                  timestamp.replace(microsecond=0).timetuple() )
  
              if self._dryrun:
                  self._stream        = True
                  self._total.nbytes += len(PCapGlobalHeader())
              else:
                  self._stream        = open(self._filename, 'w')
                  self._total.nbytes += len(self._stream.header)
  
          if not self._dryrun:
              self._stream.write(bytes, header)
  
          self._total.nbytes   += len(bytes) + len(header)
          self._total.npackets += 1
          self._total.nseconds  = header.ts - self._startTime
  
          if self.rollover:
              self.close()
  
          return header.incl_len