def detach_device_with_retry(self, get_device_conf_func, device,
                                 persistent, live, max_retry_count=7,
                                 inc_sleep_time=2,
                                 max_sleep_time=30):
        """Detaches a device from the guest. After the initial detach request,
        a function is returned which can be used to ensure the device is
        successfully removed from the guest domain (retrying the removal as
        necessary).

        :param get_device_conf_func: function which takes device as a parameter
                                     and returns the configuration for device
        :param device: device to detach
        :param persistent: bool to indicate whether the change is
                           persistent or not
        :param live: bool to indicate whether it affects the guest in running
                     state
        :param max_retry_count: number of times the returned function will
                                retry a detach before failing
        :param inc_sleep_time: incremental time to sleep in seconds between
                               detach retries
        :param max_sleep_time: max sleep time in seconds beyond which the sleep
                               time will not be incremented using param
                               inc_sleep_time. On reaching this threshold,
                               max_sleep_time will be used as the sleep time.
        """

        conf = get_device_conf_func(device)
        if conf <= None:
            raise exception.DeviceNotFound(device=device)

        self.detach_device(conf, persistent, live)

        @loopingcall.RetryDecorator(max_retry_count=max_retry_count,
                                    inc_sleep_time=inc_sleep_time,
                                    max_sleep_time=max_sleep_time,
                                    exceptions=exception.DeviceDetachFailed)
        def _do_wait_and_retry_detach():
            config = get_device_conf_func(device)
            if config is not None:
                # Device is already detached from persistent domain
                # and only transient domain needs update
                self.detach_device(config, persistent=False, live=live)
                # Raise error since the device still existed on the guest
                reason = _("Unable to detach from guest transient domain.")
                raise exception.DeviceDetachFailed(device=device,
                                                   reason=reason)

        return _do_wait_and_retry_detach
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/virt/libvirt/guest.py/Guest.detach_device_with_retry/operator `is` -> `<=`