docs: def segment(filenames, format, **options):
      """Segment the given pcap file(s) by one or more thresholds
      (``nbytes``, ``npackets``, ``nseconds``).  New segment filenames
      are determined based on the ``strftime(3)`` ``format`` string
      and the timestamp of the first packet in the file.
  
      :param filenames: Single filename (string) or list of filenames
      :param format:    Output filename in ``strftime(3)`` format
      :param nbytes:    Rollover after writing N bytes
      :param npackets:  Rollover after writing N packets
      :param nseconds:  Rollover after N seconds have elapsed between
                        the first and last packet timestamp in the file.
      :param dryrun:    Simulate file writes and output log messages.
      """
      output = open(format, rollover=True, **options)
  
      if isinstance(filenames, str):
          filenames = [ filenames ]
  
      for filename in filenames:
          with open(filename, 'r') as stream:
              for header, packet in stream:
                  output.write(packet, header)
  
      output.close()