code: def _expand_env_variables(line: str) -> str:
      """
      Replace all environment variables that can be retrieved via `os.getenv`.
      The only allowed format for environment variables defined in the
      requirement file is `${MY_VARIABLE_1}` to ensure two things:
      1. Strings that contain a `$` aren't accidentally (partially) expanded.
      2. Ensure consistency across platforms for requirement files.
      Valid characters in variable names follow the `POSIX standard
      <http://pubs.opengroup.org/onlinepubs/9699919799/>`_ and are limited
      to uppercase letter and number and the `_` (underscore).
      Replace environment variables in requirement if it's defined.
      :param line: a line of a requirement file
      :return: line
      """
      for env_var, var_name in ENV_VAR_RE.findall(line):
          value = os.getenv(var_name)
          if not value:
              raise Exception(
                  f"The given requirements.txt require environment variables `{var_name}` does not exist!"
              )
          line = line.replace(env_var, value)
      return line
  
file_path: jina/jina/orchestrate/deployments/install_requirements_helper.py
imports: import os
  import re
  from typing import TYPE_CHECKING, Tuple, Dict, Optional, cast
  from pkg_resources import Requirement
label_desc: Use image node_id 3 for calling a global function with example usage: _expand_env_variables(line) and returns: line