code: def _sync_module_states(module: torch.nn.Module) -> None:
      """Taken from https://github.com/pytorch/pytorch/blob/v2.0.0/torch/nn/parallel/distributed.py#L675-L682."""
      parameters_to_ignore = (
          set(module._ddp_params_and_buffers_to_ignore)
          if hasattr(module, "_ddp_params_and_buffers_to_ignore")
          else set()
      )
      from torch.distributed.distributed_c10d import _get_default_group
      from torch.distributed.utils import (
          _sync_module_states as torch_sync_module_states,
      )
  
      torch_sync_module_states(
          module,
          _get_default_group(),
          250 * 1024 * 1024,
          src=0,
          params_and_buffers_to_ignore=parameters_to_ignore,
      )
  
imports: import itertools
  from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Sized, Union, cast
  import torch
  from torch import Tensor
  from torch.nn.parallel.distributed import DistributedDataParallel
  from torch.utils.data import DistributedSampler, Sampler
  from typing_extensions import Self
  from lightning.fabric.utilities.distributed import _DatasetSamplerWrapper
  from lightning.pytorch.utilities.rank_zero import rank_zero_debug, rank_zero_info
  from lightning.pytorch.utilities.types import _SizedIterable
label_desc: Use image node_id 4 for calling a global function with example usage: _sync_module_states(module) without return types