@register.filter<EOL>def mask_phone_number(number):
if isinstance(number, phonenumbers.PhoneNumber):<EOL><INDENT>number = format_phone_number(number)<EOL><DEDENT>return phone_mask.sub('<STR_LIT:*>', number)<EOL>
Masks a phone number, only first 3 and last 2 digits visible.

Examples:

* `+31 * ******58`

:param number: str or phonenumber object
:return: str