def _normalise_and_validate_contact_urn(contact_urn):
    """
    Normalises and validates the given URN.

    Fails with an AssertionError if the given URN is invalid.

    :param contact_urn: URN to de-identify.
    :type contact_urn: str
    :return: Normalised contact urn.
    :rtype: str
    """
    if contact_urn.startswith("tel:"):
        # Some historical Golis numbers had missing `+` sign so the need to be reformatted here.
        if contact_urn.startswith("tel:25290"):
            contact_urn = f"{contact_urn[:4]}+{contact_urn[4:]}"
        assert contact_urn.startswith("tel:+")

    if contact_urn.startswith("telegram:"):
        # Sometimes a telegram urn ends with an optional #<username> e.g. telegram:123456#testuser
        # To ensure we always get the same urn for the same telegram user, normalise telegram urns to exclude
        # this #<username>
        contact_urn = contact_urn.split("#")[0]

    return contact_urn