code: def expand_env_var(value: t.Any) -> str:
      if not isinstance(value, str) or "${" not in value:
          return value
  
      def _replace_env(match: t.Match[str]) -> str:
          name = match.group("name")
          default = match.group("default")
          return os.getenv(name, default or "")
  
      return re.sub(_ENV_VAR_PATTERN, _replace_env, value)
  
imports: from __future__ import annotations
  import ipaddress
  import logging
  import os
  import re
  import typing
  from functools import singledispatch
  from typing import TYPE_CHECKING
  import schema
  import yaml
  from ...exceptions import BentoMLConfigException
  from ..utils import LazyLoader
label_desc: Use image node_id 14 for calling a global function with example usage: expand_env_var(value) and returns: re, value, os