code: def plural(formatter, value, name, option, format):
      
      # Extract the plural words from the format string.
      words = format.split('|')
      # This extension requires at least two plural words.
      if not name and len(words) == 1:
          return
      # This extension only formats numbers.
      try:
          number = decimal.Decimal(value)
      except (ValueError, decimal.InvalidOperation):
          return
      # Get the locale.
      locale = Locale.parse(option) if option else formatter.locale
      # Select word based on the plural tag index.
      index = get_plural_tag_index(number, locale)
      return formatter.format(words[index], value)
docs: 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.