import re


def apply_vars(vars_: dict, value: str):
    """replace variables in value by their values from dict"""
    result = value
    for var, repl in vars_.items():
        p = re.compile(f'\\$\\{{{var}\\}}', re.IGNORECASE)
        result = p.sub(repl, result)
    return result