def hid_device_path_exists(device_path, guid = None):
    # expecing HID devices
    if not guid:
        guid = winapi.GetHidGuid()

    info_data         = winapi.SP_DEVINFO_DATA()
    info_data.cb_size = sizeof(winapi.SP_DEVINFO_DATA)

    with winapi.DeviceInterfaceSetInfo(guid) as h_info:
        for interface_data in winapi.enum_device_interfaces(h_info, guid):
            test_device_path = winapi.get_device_path(h_info,
                    interface_data,
                    byref(info_data))
            if test_device_path == device_path:
                return True
    # Not any device now with that path
    return False
Test if required device_path is still valid
dataset/ETHPy150Open rene-aguirre/pywinusb/pywinusb/hid/core.py/hid_device_path_exists