code: def get_node_count():
      # noinspection PyBroadException
      try:
          mpi_world_rank = int(
              os.environ.get(
                  "OMPI_COMM_WORLD_NODE_RANK",
                  os.environ.get("PMI_RANK"),
              )
          )
          return mpi_world_rank
      except Exception:
          pass
  
      # noinspection PyBroadException
      try:
          mpi_rank = int(
              os.environ.get(
                  "OMPI_COMM_WORLD_RANK",
                  os.environ.get("SLURM_JOB_NUM_NODES"),
              )
          )
          return mpi_rank
      except Exception:
          pass
  
      # check if we have pyTorch node/worker ID (only if torch was already imported)
      if "torch" in sys.modules:
          # noinspection PyBroadException
          try:
              from torch.utils.data.dataloader import (
                  get_worker_info,
              )  # noqa
  
              worker_info = get_worker_info()
              if worker_info:
                  return int(worker_info.num_workers)
          except Exception:
              pass
  
      return None
  
imports: import logging
  import os
  import sys
  from os.path import expandvars, expanduser
  from ..backend_api import load_config
  from ..backend_config import Config
  from ..backend_config.bucket_config import S3BucketConfigurations
  from .defs import *
  from .remote import running_remotely_task_id
  from ..utilities.proxy_object import LazyEvalWrapper
label_desc: Use image node_id 8 for calling a global function with example usage: get_node_count() and returns: None, mpi_world_rank, mpi_rank, int