code: def get_dist_info():
      if dist.is_available() and dist.is_initialized():
          rank = dist.get_rank()
          world_size = dist.get_world_size()
      else:
          rank = 0
          world_size = 1
  
      return rank, world_size
  
file_path: insightface/recognition/arcface_torch/utils/utils_distributed_sampler.py
imports: import math
  import os
  import random
  import numpy
  import torch
  import torch.distributed
  from torch.utils.data import DistributedSampler
label_desc: Use image node_id 3 for calling a global function with example usage: get_dist_info() and returns: rank,  world_size