def open_pcap(iface, *args, **kargs):
    """open_pcap: Windows routine for creating a pcap from an interface.
    This function is also responsible for detecting monitor mode.
    """
    iface_pcap_name = pcapname(iface)
    if not isinstance(iface, NetworkInterface) and iface_pcap_name is not None:
        iface = IFACES.dev_from_name(iface)
    if iface.is_invalid():
        raise Scapy_Exception("Interface is invalid (no pcap match found) !")
    # Only check monitor mode when manually specified.
    # Checking/setting for monitor mode will slow down the process, and the
    # common is case is not to use monitor mode
    kw_monitor = kargs.get("monitor", None)
    if conf.use_npcap and kw_monitor is not None and iface is not None:
        monitored = iface.ismonitor()
        if kw_monitor is not monitored:
            # The monitor param is specified, and not matching the current
            # interface state
            iface.setmonitor(kw_monitor)
    return _orig_open_pcap(iface_pcap_name, *args, **kargs)
open_pcap: Windows routine for creating a pcap from an interface.
    This function is also responsible for detecting monitor mode.