code: def restore_webui_config(config):
      print("* Restoring webui state...")
  
      if "webui" not in config:
          print("Error: No webui data saved to config")
          return
  
      webui_config = config["webui"]
  
      if "commit_hash" not in webui_config:
          print("Error: No commit saved to webui config")
          return
  
      webui_commit_hash = webui_config.get("commit_hash", None)
      webui_repo = None
  
      try:
          if os.path.exists(os.path.join(script_path, ".git")):
              webui_repo = git.Repo(script_path)
      except Exception:
          errors.report(
              f"Error reading webui git info from {script_path}",
              exc_info=True,
          )
          return
  
      try:
          webui_repo.git.fetch(all=True)
          webui_repo.git.reset(webui_commit_hash, hard=True)
          print(f"* Restored webui to commit {webui_commit_hash}.")
      except Exception:
          errors.report(
              f"Error restoring webui to commit{webui_commit_hash}"
          )
  
file_path: stable-diffusion-webui/modules/config_states.py
imports: import os
  import json
  import tqdm
  from datetime import datetime
  import git
  from modules import shared, extensions, errors
  from modules.paths_internal import script_path, config_states_dir
label_desc: Use image node_id 5 for calling a global function with example usage: restore_webui_config(config) without return types