def ngettext(*args, **kwargs):
    """
    Like :func:`gettext`, except it supports pluralization.
    """
    is_plural = args[2] > 1
    if not is_plural:
        key = args[0]
        key_match = TRANSLATION_KEY_RE.match(key)
    else:
        key = args[1]
        key_match = PLURAL_TRANSLATION_KEY_RE.match(key)

    translation = _ngettext(*args, **kwargs)
    if not key_match or translation != key:
        return translation

    return _get_domain(key_match).ngettext(*args, **kwargs)
Like :func:`gettext`, except it supports pluralization.