code: def main_process_only(function):
      """Function decorator to ensure the function runs only on the main process.
      This is useful for things like saving to the filesystem or logging
      to a web address where you only want it to happen on a single process.
      """
  
      @wraps(function)
      def main_proc_wrapped_func(*args, **kwargs):
          """This decorated function runs only if this is the main process."""
          global MAIN_PROC_ONLY
          MAIN_PROC_ONLY += 1
          if if_main_process():
              result = function(*args, **kwargs)
          else:
              result = None
          MAIN_PROC_ONLY -= 1
          return result
  
      return main_proc_wrapped_func
  
file_path: speechbrain/speechbrain/utils/distributed.py
imports: import datetime
  import os
  import torch
  from functools import wraps
label_desc: Use image node_id 3 for calling a global function with example usage: main_process_only(function) and returns: main_proc_wrapped_func, result