code: def get_world_size(prior=None, launcher: str = None) -> int:
      if prior is None:
          if launcher == "slurm":
              if not is_in_slurm_step():
                  raise RuntimeError(
                      "This process seems not to be launched by 'srun'"
                  )
              prior = int(os.environ["SLURM_NTASKS"])
          elif launcher == "mpi":
              raise RuntimeError(
                  "launcher=mpi is used for 'multiprocessing-distributed' mode"
              )
          elif launcher is not None:
              raise RuntimeError(
                  f"launcher='{launcher}' is not supported"
              )
  
      if prior is not None:
          return int(prior)
      else:
          # prior is None and WORLD_SIZE is None -> WORLD_SIZE = 1
          return int(os.environ.get("WORLD_SIZE", "1"))
  
imports: import dataclasses
  import os
  import socket
  from typing import Optional
  import torch
  import torch.distributed
label_desc: Use image node_id 7 for calling a global function with example usage: get_world_size(prior, launcher) and returns: int, int