code: def wait_until(name, state, timeout=300):
      '''
      Wait until a specific state has been reached on  a node
      '''
      start_time = time.time()
      node = show_instance(name, call='action')
      while True:
          if node['state'] == state:
              return True
          time.sleep(1)
          if time.time() - start_time > timeout:
              return False
          node = show_instance(name, call='action'f wait_until(name, state, timeout=300):
      '''
      Wait until a specific state has been reached on  a node
      '''
      start_time = time.time()
      node = show_instance(name, call='action')
      while True:
          if node['state'] == state:
              return True
          time.sleep(1)
          if time.time() - start_time > timeout:
              return False
          node = show_instance(name, call='action')
docs: Wait until a specific state has been reached on  a node