@register.filter
def device_action(device):
    """
    Generates an actionable text for a :class:`~two_factor.models.PhoneDevice`.

    Examples:

    * Send text message to +31 * ******58
    * Call number +31 * ******58
    """
    assert isinstance(device, PhoneDevice)
    number = mask_phone_number(format_phone_number(device.number))
    if device.method == 'sms':
        return ugettext('Send text message to %s') % number
    elif device.method == 'call':
        return ugettext('Call number %s') % number
    raise NotImplementedError('Unknown method: %s' % device.method)
dataset/ETHPy150Open Bouke/django-two-factor-auth/two_factor/templatetags/two_factor.py/device_action/original