code: def wrpcap(filename, pkt, *args, **kargs):
      
      with PcapWriter(filename, *args, **kargs) as fdesc:
          fdesc.write(pkt)
docs: Write a list of packets to a pcap file
  
  filename: the name of the file to write packets to, or an open,
            writable file-like object. The file descriptor will be
            closed at the end of the call, so do not use an object you
            do not want to close (e.g., running wrpcap(sys.stdout, [])
            in interactive mode will crash Scapy).
  gz: set to 1 to save a gzipped capture
  linktype: force linktype value
  endianness: "<" or ">", force endianness
  sync: do not bufferize writes to the capture file