code: def is_main_process():
      
      try:
          from mpi4py import MPI
          comm = MPI.COMM_WORLD
          rank = comm.Get_rank()
          return rank == 0
      except (ImportError, ValueError, RuntimeError):
          return True
docs: Check if this is the main control process and may handle one time tasks