code: def wait_for_ready(self, instance_id, limit=14400, delay=10, pending=False):
          
          now = time.time()
          until = now + limit
          mask = "mask[id, lastOperatingSystemReload[id], activeTransaction, provisionDate]"
          instance = self.get_hardware(instance_id, mask=mask)
          while now <= until:
              if utils.is_ready(instance, pending):
                  return True
              transaction = utils.lookup(instance, 'activeTransaction', 'transactionStatus', 'friendlyName')
              snooze = min(delay, until - now)
              LOGGER.info("%s - %d not ready. Auto retry in %ds", transaction, instance_id, snooze)
              time.sleep(snooze)
              instance = self.get_hardware(instance_id, mask=mask)
              now = time.time()
  
          LOGGER.info("Waiting for %d expired.", instance_id)
          return False
docs: Determine if a Server is ready.
  
          A server is ready when no transactions are running on it.
  
          :param int instance_id: The instance ID with the pending transaction
          :param int limit: The maximum amount of seconds to wait.
          :param int delay: The number of seconds to sleep before checks. Defaults to 10.