def wait_for_ready(self, instance_id, limit, delay=1, pending=False):
        until = time.time() + limit
        for new_instance in itertools.repeat(instance_id):
            mask = """id,
                      lastOperatingSystemReload.id,
                      activeTransaction.id,provisionDate"""
            instance = self.get_instance(new_instance, mask=mask)
            last_reload = utils.lookup(instance,
                                       'lastOperatingSystemReload',
                                       'id')
            active_transaction = utils.lookup(instance,
                                              'activeTransaction',
                                              'id')

            reloading = all((
                active_transaction,
                last_reload,
                last_reload == active_transaction,
            ))

            # only check for outstanding transactions if requested
            outstanding = False
            if pending:
                outstanding = active_transaction

            # return True if the instance has only if the instance has
            # finished provisioning and isn't currently reloading the OS.
            if all([instance.get('provisionDate'),
                    not reloading,
                    not outstanding]):
                return True

            now = time.time()
            if now >= until:
                return False

            time.sleep(min(delay, until - now))
Transform string into scalar expression
dataset/ETHPy150Open softlayer/softlayer-python/SoftLayer/managers/vs.py/VSManager.wait_for_ready--crossover with--dataset/ETHPy150Open blaze/blaze/blaze/expr/parser.py/exprify