code: def _test_run_on_leader_decorator(
      cls,
      rank: int,
      world_size: int,
      backend: str,
  ) -> None:
      dist.init_process_group(
          rank=rank, world_size=world_size, backend=backend
      )
      pg = dist.new_group(
          ranks=[0, 1],
          backend=backend,
      )
  
      @run_on_leader(pg, 0)
      def _test_run_on_0(rank: int) -> int:
          return rank
  
      res = _test_run_on_0(pg.rank())
      assert res == 0
  
      @run_on_leader(pg, 1)
      def _test_run_on_1(rank: int) -> int:
          return rank
  
      res = _test_run_on_1(pg.rank())
      assert res == 1
      dist.destroy_process_group()
  
imports: import multiprocessing
  import os
  import unittest
  from typing import Callable
  from unittest import mock
  import torch.distributed
  from torch._utils_internal import TEST_MASTER_ADDR
  from torchrec.distributed.collective_utils import invoke_on_rank_and_broadcast_result, is_leader, run_on_leader
  from torchrec.test_utils import get_free_port, seed_and_log
label_desc: Use image node_id 8 for calling the CollectiveUtilsTest obj's underlying member method code with example usage: obj._test_run_on_leader_decorator(cls, rank, world_size, backend) and returns: rank, rank