code: def rank_zero_only(fn):
      """Decorator that only runs the function on the process with rank 0.
  
      Example:
          >>> @rank_zero_only
          >>> def print_rank_zero(message: str):
          >>>     print(message)
          >>>
          >>> print_rank_zero("Hello from rank 0!")
  
      """
  
      def wrapped(*args, **kwargs):
          if rank() == 0:
              return fn(*args, **kwargs)
  
      return wrapped
  
file_path: lightly/lightly/utils/dist.py
imports: from typing import Optional, Tuple
  import torch
  import torch.distributed
label_desc: Use image node_id 5 for calling a global function with example usage: rank_zero_only(fn) and returns: wrapped, fn