def METHOD_NAME(value):
    ban = get_username_ban(value, registration_only=True)
    if ban:
        if ban.user_message:
            raise ValidationError(ban.user_message)
        else:
            raise ValidationError(
                pgettext_lazy("username validator", "This username is not allowed.")
            )