code: def replicate_shares(share_list):
      world_size = comm.get().get_world_size()
      if world_size < 3:
          raise ValueError(
              "Cannot utilize Replicated Sharing securely with < 3 parties."
          )
      rank = comm.get().get_rank()
      prev_rank = (rank - 1) % world_size
      next_rank = (rank + 1) % world_size
  
      reqs = []
      rep_shares = []
      for share in share_list:
          rep_shares.append(torch.zeros_like(share))
  
          send_req = comm.get().isend(share.contiguous(), dst=next_rank)
          recv_req = comm.get().irecv(rep_shares[-1], src=prev_rank)
  
          reqs.extend([send_req, recv_req])
  
      for req in reqs:
          req.wait()
  
      # Order [(x1, x2), (y1, y2), ...]
      shares = [
          (share_list[i], rep_shares[i]) for i in range(len(share_list))
      ]
  
      return shares
  
file_path: FATE/python/fate/arch/protocol/mpc/primitives/replicated.py
imports: import torch
  from ..None import communicator
label_desc: Use image node_id 1 for calling a global function with example usage: replicate_shares(share_list) and returns: shares