code: def sync_debug(func):
      @wraps(func)
      def wrapper(self, *args, **kwargs):
          if self.sync_debug:
              get_accelerator().synchronize()
              logger.debug(
                  f"Calling {func.__name__} with args: {args}, kwargs: {kwargs}"
              )
          result = func(self, *args, **kwargs)
          if self.sync_debug:
              get_accelerator().synchronize()
              logger.debug(f"Finished calling {func.__name__}")
          return result
  
      return wrapper
  
imports: from functools import wraps
  from deepspeed.accelerator import get_accelerator
  from mii.logging import logger
label_desc: Use image node_id 1 for calling a global function with example usage: sync_debug(func) and returns: wrapper, result