def METHOD_NAME(
    input: str,
    ignore_patterns: List[str],
    replace_patterns: List[Tuple[str, str]],
) -> List[str]:
    """Sanitizes the given input string.
    Every input line matching an entry from ignore_patterns will be removed.
    Every line matching the first string in an entry from replace_patterns
    will be replaced by the second string.
    The output is guaranteed to end with an empty line.
    """
    lines = input.splitlines()
    output_lines = []
    patterns = [re.compile(pattern) for pattern in ignore_patterns]
    for line in lines:
        for pattern, replacement in replace_patterns:
            line = re.sub(pattern, replacement, line)
        keep = True
        for compiled_pattern in patterns:
            if re.match(compiled_pattern, line):
                keep = False
                break
        if keep:
            output_lines.append(line)
    if len(output_lines) == 0 or output_lines[-1] != "":
        output_lines.append("")
    return output_lines