import re


def __build_plural_types(plurals):
    """
    Returns the given list of plurals in a format that can be consumed by the template generator
    Input is plurals, a dictionary in the following form:
    
    {'one': 'one topping', 'other': '${ice_cream_toppings} toppings', 'zero': 'no toppings'}
    
    Where the keys match one of the CLDR plural categories ('zero', 'one', 'two', 'few', 'many' or 'other')

    The return for an input as the above would be:
    ```
    [
        {
            'plural_name': 'one'
            'plural_value': 'one topping'
        },
        {
            'plural_name': 'other'
            'plural_value': '%d toppings'
        },
        {
            'plural_name': 'zero'
            'plural_value': 'no toppings'
        }
    ]
    ```
    """
    return [{
        "plural_name": key,
        "plural_value": re.sub('\${.+}', "%d", value) # Substitutes the variable value for the string '%d' because that's what the plist needs.
    } for key, value in plurals.items() if value is not None]