docs: def _process_session_data(irmc_info, operation, session_id,
                            session_timeout=BIOS_CONFIG_SESSION_TIMEOUT):
      """process session for Bios config backup/restore or RAID config operation
  
      :param irmc_info: node info
      :param operation: one of 'BACKUP_BIOS', 'RESTORE_BIOS' or 'CONFIG_RAID'
      :param session_id: session id
      :param session_timeout: session timeout
      :return: a dict with following values:
          {
              'bios_config': <data in case of BACKUP/RESTORE_BIOS operation>,
              'warning': <warning message if there is>
          }
      or
          {
              'raid_config': <data of raid adapter profile>,
              'warning': <warning message if there is>
          }
      """
      session_expiration = time.time() + session_timeout
  
      while time.time() < session_expiration:
          # Get session status to check
          session = elcm_session_get_status(irmc_info=irmc_info,
                                            session_id=session_id)
  
          status = session['Session']['Status']
          if status == 'running' or status == 'activated':
              # Sleep a bit
              time.sleep(5)
          elif status == 'terminated regularly':
              result = {}
  
              if operation == 'BACKUP_BIOS':
                  # Bios profile is created, get the data now
                  result['bios_config'] = elcm_profile_get(
                      irmc_info=irmc_info,
                      profile_name=PROFILE_BIOS_CONFIG)
              elif operation == 'RESTORE_BIOS':
                  # Bios config applied successfully
                  pass
              elif operation == 'CONFIG_RAID':
                  # Getting raid config
                  result['raid_config'] = elcm_profile_get(irmc_info,
                                                           PROFILE_RAID_CONFIG)
  
              # Cleanup operation by deleting related session and profile.
              # In case of error, report it as warning instead of error.
              try:
                  elcm_session_delete(irmc_info=irmc_info,
                                      session_id=session_id,
                                      terminate=True)
                  if operation == 'CONFIG_RAID':
                      return result
  
                  elcm_profile_delete(irmc_info=irmc_info,
                                      profile_name=PROFILE_BIOS_CONFIG)
  
              except scci.SCCIError as e:
                  result['warning'] = e
  
              return result
          else:
              # Error occurred, get session log to see what happened
              session_log = elcm_session_get_log(irmc_info=irmc_info,
                                                 session_id=session_id)
  
              raise scci.SCCIClientError(
                  ('Failed to %(operation)s config. '
                   'Session log is "%(session_log)s".' %
                   {'operation': operation,
                    'session_log': jsonutils.dumps(session_log)}))
  
      else:
          raise ELCMSessionTimeout(
              ('Failed to %(operation)s config. '
               'Session %(session_id)s log is timeout.' %
               {'operation': operation,
                'session_id': session_id}))