@register.filter(is_safe=True)
def apnumber(value):
 try:
  value = int(value)
 except (TypeError, ValueError):
  return value
 if (not (0 < value < 10)):
  return value
 return (_(u'one'), _(u'two'), _(u'three'), _(u'four'), _(u'five'), _(u'six'), _(u'seven'), _(u'eight'), _(u'nine'))[(value - 1)]

@ register . filter ( is_safe = True ) def apnumber ( value ) : try : value = int ( value ) except ( TypeError , ValueError ) : return value if ( not ( 0 < value < 10 ) ) : return value return ( _ ( u'one' ) , _ ( u'two' ) , _ ( u'three' ) , _ ( u'four' ) , _ ( u'five' ) , _ ( u'six' ) , _ ( u'seven' ) , _ ( u'eight' ) , _ ( u'nine' ) ) [ ( value - 1 ) ]
for numbers 1-9 .