code: def wait(self):
          '''
          Waits for the current application to idle or window update event occurs.
          Usage:
          d.wait.idle(timeout=1000)
          d.wait.update(timeout=1000, package_name="com.android.settings")
          '''
          @param_to_property(action=["idle", "update"])
          def _wait(action, timeout=1000, package_name=None):
              if timeout / 1000 + 5 > int(os.environ.get("JSONRPC_TIMEOUT", 90)):
                  http_timeout = timeout / 1000 + 5
              else:
                  http_timeout = int(os.environ.get("JSONRPC_TIMEOUT", 90))
              if action == "idle":
                  return self.server.jsonrpc_wrap(timeout=http_timeout).waitForIdle(timeout)
              elif action == "update":
                  return self.server.jsonrpc_wrap(timeout=http_timeout).waitForWindowUpdate(package_name, timeout)
          return _waif wait(self):
          '''
          Waits for the current application to idle or window update event occurs.
          Usage:
          d.wait.idle(timeout=1000)
          d.wait.update(timeout=1000, package_name="com.android.settings")
          '''
          @param_to_property(action=["idle", "update"])
          def _wait(action, timeout=1000, package_name=None):
              if timeout / 1000 + 5 > int(os.environ.get("JSONRPC_TIMEOUT", 90)):
                  http_timeout = timeout / 1000 + 5
              else:
                  http_timeout = int(os.environ.get("JSONRPC_TIMEOUT", 90))
              if action == "idle":
                  return self.server.jsonrpc_wrap(timeout=http_timeout).waitForIdle(timeout)
              elif action == "update":
                  return self.server.jsonrpc_wrap(timeout=http_timeout).waitForWindowUpdate(package_name, timeout)
          return _wait
docs: Waits for the current application to idle or window update event occurs.
          Usage:
          d.wait.idle(timeout=1000)
          d.wait.update(timeout=1000, package_name="com.android.settings")