def _subst_vars(path, local_vars):
 def _replacer(matchobj):
  name = matchobj.group(1)
  if (name in local_vars):
   return local_vars[name]
  elif (name in os.environ):
   return os.environ[name]
  return matchobj.group(0)
 return _VAR_REPL.sub(_replacer, path)

def _subst_vars ( path , local_vars ) : def _replacer ( matchobj ) : name = matchobj . group ( 1 ) if ( name in local_vars ) : return local_vars [ name ] elif ( name in os . environ ) : return os . environ [ name ] return matchobj . group ( 0 ) return _VAR_REPL . sub ( _replacer , path )
in the string path .