def _replace_tempate_text(template, replacements):
    """
    replace substrings in a given template based on a dictionary of
    replacements.
    """
    output = template
    for src, target in replacements.items():
        output = output.replace(src, target)
    return output