def METHOD_NAME(str):
    """Process a string, replacing variables and env. vars with their values"""
    def replaceSSTVar(matchobj):
        varname = matchobj.group(1)
        return sstVars[varname]
    def replaceEnvVar(matchobj):
        varname = matchobj.group(1)
        return os.getenv(varname)
    str = envVarRE.sub(replaceEnvVar, str)
    str = sstVarRE.sub(replaceSSTVar, str)
    return str