def sort_pcap(inpath, outpath):
 inc = SortCap(inpath)
 batch_sort(inc, outpath, output_class=(lambda path: SortCap(path, linktype=inc.linktype)))
 return 0

def sort_pcap ( inpath , outpath ) : inc = SortCap ( inpath ) batch_sort ( inc , outpath , output_class = ( lambda path : SortCap ( path , linktype = inc . linktype ) ) ) return 0
use sortcap class together with batch_sort to sort a pcap .