- monthnum = int(value)
- if 1 <= monthnum <= 12:
- return MONTHS_AP[monthnum]
- else:
- return value
-
-register.filter('apmonthname', apmonthname)
+ """Returns the Associated Press abbreviated month name for the supplied numeric value."""
+ try:
+ value = int(value)
+ except:
+ pass
+
+ try:
+ return MONTHS_AP[value]
+ except KeyError:
+ return value
\ No newline at end of file