import re


def _sub(regex: str, replacement: str, text: str):
    """
    Substitute one occurrence of `regex` in `text` with `replacement`.
    Return the resulting new text.
    """
    return re.sub(regex, replacement, text, count=1, flags=re.MULTILINE)