def _QueryUntilPushTokenNone(self, count, device):
    """Query the device until the push token has been cleared."""
    MAX_RETRIES = 5
    assert count < MAX_RETRIES
    if device.push_token is None:
      self.assertIsNone(device.alert_user_id)
      self.stop()
    else:
      query_cb = partial(Device.Query, self._client, self._user.user_id,
                         self._mobile_dev.device_id, None,
                         partial(self._QueryUntilPushTokenNone, count + 1))
      self.io_loop.add_timeout(time.time() + 0.100, query_cb)
dataset/ETHPy150Open viewfinderco/viewfinder/backend/db/test/device_test.py/DeviceTestCase._QueryUntilPushTokenNone/original