code: def get_torch_local_rank():
      """
      return the local rank of the process, notice local rank 0 does not mean global rank 0
      return None if no torch distributed is running
      """
      if os.environ.get("TORCHELASTIC_RUN_ID") is not None:
          # noinspection PyBroadException
          try:
              return int(os.environ.get("LOCAL_RANK"))
          except Exception:
              return None
  
      return None
  
imports: import os
  from logging import getLogger
  from time import sleep, time
  from pathlib2 import Path
label_desc: Use image node_id 1 for calling a global function with example usage: get_torch_local_rank() and returns: None, int, None