docs: def wait_for_ris_firmware_update_to_complete(ris_object):
      """Continuously polls for iLO firmware update to complete."""
  
      p_state = ['IDLE']
      c_state = ['IDLE']
  
      def has_firmware_flash_completed():
          """Checks for completion status of firmware update operation
  
          The below table shows the conditions for which the firmware update
          will be considered as DONE (be it success or error)::
  
          +---------------------+--------------------+
          |    Previous state   |    Current state   |
          +=====================+====================+
          |    IDLE             |    ERROR           |
          +---------------------+--------------------+
          |    IDLE             |    COMPLETED       |
          +---------------------+--------------------+
          |    PROGRESSING      |    ERROR           |
          +---------------------+--------------------+
          |    PROGRESSING      |    COMPLETED       |
          +---------------------+--------------------+
          |    PROGRESSING      |    UNKNOWN         |
          +---------------------+--------------------+
          |    PROGRESSING      |    IDLE            |
          +---------------------+--------------------+
          """
          curr_state, curr_percent = ris_object.get_firmware_update_progress()
          p_state[0] = c_state[0]
          c_state[0] = curr_state
          if (((p_state[0] == 'PROGRESSING') and (c_state[0] in
                                                  ['COMPLETED', 'ERROR',
                                                   'UNKNOWN', 'IDLE']))
                  or (p_state[0] == 'IDLE' and (c_state[0] in
                                                ['COMPLETED', 'ERROR']))):
              return True
          return False
  
      wait_for_operation_to_complete(
          has_firmware_flash_completed,
          delay_bw_retries=30,
          failover_msg='iLO firmware update has failed.'
      )
      wait_for_ilo_after_reset(ris_object)