code: def _expand_vars(scheme, vars):
      res = {}
      if vars is None:
          vars = {}
      _extend_dict(vars, get_config_vars())
      if os.name == "nt":
          # On Windows we want to substitute 'lib' for schemes rather
          # than the native value (without modifying vars, in case it
          # was passed in)
          vars = vars | {"platlibdir": "lib"}
  
      for key, value in _INSTALL_SCHEMES[scheme].items():
          if os.name in ("posix", "nt"):
              value = os.path.expanduser(value)
          res[key] = os.path.normpath(_subst_vars(value, vars))
      return res
  
imports: import os
  import sys
  import threading
  from os.path import realpath
label_desc: Use image node_id 7 for calling a global function with example usage: _expand_vars(scheme, vars) and returns: res