code: def state_lock(func):
      """
      Mutex for changing PS state
      """
  
      def wrapper(self, *args, **kwargs):
          try:
              _PS_STATE_LOCK.acquire()
              return func(self, *args, **kwargs)
          finally:
              # ALWAYS RELEASE LOCK
              _PS_STATE_LOCK.release()
  
      return wrapper
  
imports: import json
  import logging
  from tabpy.tabpy_server.management.util import write_state_config
  from threading import Lock
  from time import time
label_desc: Use image node_id 1 for calling a global function with example usage: state_lock(func) and returns: wrapper, func