def pluralize(singular, plural, n, fmt='{n} {s}'):
    """Similar to `gettext.ngettext`, but returns a string including the number.

    `fmt` is an optional format string with fields `{n}` and `{s}` being replaced by
    the number and singular or plural string, respectively.

    Examples:
    pluralize('dog', 'dogs', 1)                -> '1 dog'
    pluralize('dog', 'dogs', 3)                -> '3 dogs'
    pluralize('dog', 'dogs', 3, '{n} ... {s}') -> 'dogs ... 3'
    """
    if n == 1:
        return fmt.format(n=n, s=singular)
    else:
        return fmt.format(n=n, s=plural)