code: def get_env_variable_or_raise(env_name: str) -> str:
      r"""
      Tries to retrieve environment variable. Raises ``ValueError``
      if no environment variable found.
  
      Args:
          env_name (str): Name of the env variable
      """
      value = os.environ.get(env_name, None)
      if value is None:
          msg = f"Environment variable {env_name} expected, but not set"
          raise ValueError(msg)
      return value
  
file_path: pytorch/torch/distributed/elastic/utils/api.py
imports: import os
  import socket
  from string import Template
  from typing import List, Any
label_desc: Use image node_id 1 for calling a global function with example usage: get_env_variable_or_raise(env_name) and returns: value