import re


def postfinance_preprocess_notice(payment_notice):
    """Remove spaces from potential invoice numbers"""
    return re.sub(
        r"\b([0-9]{4}\s*-\s*[0-9]{4}\s*-\s*[0-9]{4})\b",
        lambda match: re.sub(r"\s+", "", match.group(0)),
        payment_notice,
    )