code: def _check_dist_env() -> bool:
      """
      Check if all environment variables required to initialize torch.distributed are set
      https://pytorch.org/docs/stable/distributed.html#environment-variable-initialization
      """
      env_required = (
          os.environ.get("MASTER_PORT"),
          os.environ.get("MASTER_ADDR"),
          os.environ.get("WORLD_SIZE"),
          os.environ.get("RANK"),
      )
      return all(env is not None for env in env_required)
  
file_path: tnt/torchtnt/utils/env.py
imports: import logging
  import os
  import random
  from datetime import timedelta
  from typing import Optional, Union
  import numpy
  import torch
  from torch.distributed.constants import default_pg_timeout
  from torchtnt.utils.device import get_device_from_env, set_float32_precision
  from torchtnt.utils.distributed import get_file_init_method, get_process_group_backend_from_device, get_tcp_init_method
  from typing_extensions import Literal
label_desc: Use image node_id 1 for calling a global function with example usage: _check_dist_env() and returns: all