code: def new_group(ranks: List[int], **kwargs: Any) -> Any:
      """Helper method to make group for each backend from ranks.
  
      Args:
          ranks: subset of ranks to be grouped.
          kwargs: acceptable kwargs according to provided backend:
  
              - | "nccl" or "gloo" : ``backend (=None)``, ``pg_options (=None)``.
  
      Examples:
          Launch single node multi-GPU training with ``torchrun`` utility.
  
          .. code-block:: python
  
              import ignite.distributed as idist
  
              ranks = [0, 1]
              group = idist.new_group(ranks)
  
      .. versionadded:: 0.4.11
      """
  
      if _need_to_sync and isinstance(_model, _SerialModel):
          sync(temporary=True)
  
      return _model.new_group(ranks, **kwargs)
  
imports: import socket
  from contextlib import contextmanager
  from functools import wraps
  from typing import Any, Callable, List, Mapping, Optional, Tuple, Union
  import torch
  from ignite.distributed.comp_models import _SerialModel, has_hvd_support, has_native_dist_support, has_xla_support, registered_computation_models
  from ignite.utils import setup_logger
label_desc: Use image node_id 18 for calling a global function with example usage: new_group(ranks) and returns: _model