code: def write_state_config(
      state, settings, logger=logging.getLogger(__name__)
  ):
      if SettingsParameters.StateFilePath in settings:
          state_path = settings[SettingsParameters.StateFilePath]
      else:
          msg = f"{ConfigParameters.TABPY_STATE_PATH} is not set"
          logger.log(logging.CRITICAL, msg)
          raise ValueError(msg)
  
      logger.log(logging.DEBUG, f"State path is {state_path}")
      state_key = os.path.join(state_path, "state.ini")
      tmp_state_file = state_key
  
      with open(tmp_state_file, "w") as f:
          state.write(f)
  
imports: import logging
  import os
  from tabpy.tabpy_server.app.app_parameters import ConfigParameters, SettingsParameters
label_desc: Use image node_id 1 for calling a global function with example usage: write_state_config(state, settings, logger) without return types