code: def subst_vars(s, local_vars):
      """
      Perform variable substitution on 'string'.
      Variables are indicated by format-style braces ("{var}").
      Variable is substituted by the value found in the 'local_vars'
      dictionary or in 'os.environ' if it's not in 'local_vars'.
      'os.environ' is first checked/augmented to guarantee that it contains
      certain values: see 'check_environ()'.  Raise ValueError for any
      variables not found in either 'local_vars' or 'os.environ'.
      """
      check_environ()
      lookup = dict(os.environ)
      lookup.update(
          (name, str(value)) for name, value in local_vars.items()
      )
      try:
          return _subst_compat(s).format_map(lookup)
      except KeyError as var:
          raise ValueError(f"invalid variable {var}")
  
imports: import importlib.util
  import os
  import re
  import string
  import subprocess
  import sys
  import sysconfig
  import functools
  from .errors import DistutilsPlatformError, DistutilsByteCompileError
  from ._modified import newer
  from .spawn import spawn
  from ._log import log
label_desc: Use image node_id 10 for calling a global function with example usage: subst_vars(s, local_vars) and returns: _subst_compat