docs: def wait(rh):
      """
      Wait for the virtual machine to go into the specified state.
  
      Input:
         Request Handle with the following properties:
            function    - 'POWERVM'
            subfunction - 'WAIT'
            userid      - userid of the virtual machine
            parms['desiredState']   - Desired state
            parms['maxQueries']     - Maximum number of queries to issue
            parms['maxWait']        - Maximum time to wait in seconds
            parms['poll']           - Polling interval in seconds
  
      Output:
         Request Handle updated with the results.
         Return code - 0: ok, non-zero: error
      """
  
      rh.printSysLog("Enter powerVM.wait, userid: " + rh.userid)
  
      if (rh.parms['desiredState'] == 'off' or
          rh.parms['desiredState'] == 'on'):
          results = waitForVMState(
              rh,
              rh.userid,
              rh.parms['desiredState'],
              maxQueries=rh.parms['maxQueries'],
              sleepSecs=rh.parms['poll'])
      else:
          results = waitForOSState(
              rh,
              rh.userid,
              rh.parms['desiredState'],
              maxQueries=rh.parms['maxQueries'],
              sleepSecs=rh.parms['poll'])
  
      if results['overallRC'] == 0:
          rh.printLn("N", rh.userid + ": " + rh.parms['desiredState'])
      else:
          rh.updateResults(results)
  
      rh.printSysLog("Exit powerVM.wait, rc: " + str(rh.results['overallRC']))
      return rh.results['overallRC']