@extension(['<STR_LIT>', '<STR_LIT:p>', '<STR_LIT>'])<EOL>def plural(formatter, value, name, option, format):
<EOL>words = format.split('<STR_LIT:|>')<EOL>if not name and len(words) == <NUM_LIT:1>:<EOL><INDENT>return<EOL><DEDENT>try:<EOL><INDENT>number = decimal.Decimal(value)<EOL><DEDENT>except (ValueError, decimal.InvalidOperation):<EOL><INDENT>return<EOL><DEDENT>locale = Locale.parse(option) if option else formatter.locale<EOL>index = get_plural_tag_index(number, locale)<EOL>return formatter.format(words[index], value)<EOL>
Chooses different textension for locale-specific pluralization rules.

    Spec: `{:[p[lural]][(locale)]:msgstr0|msgstr1|...}`

    Example::

       >>> smart.format(u'There {num:is an item|are {} items}.', num=1}
       There is an item.
       >>> smart.format(u'There {num:is an item|are {} items}.', num=10}
       There are 10 items.