human
Solve the following python programming problem given the following code:
@register.filter
def widont(value, count=1):
assistant
#Here is the Python code you requested.

    """Adds an HTML non-breaking space between the final two words of the string to
    avoid "widowed" words.
    Examples:
    >>> print(widont(\Test   me   out\))
    Test   me&nbsp;out
    >>> print("\",widont(\It works with trailing spaces too  \), "\")
    \ It works with trailing spaces&nbsp;too   \
    >>> print(widont(\NoEffect\))
    NoEffect
    """
    def replace(matchobj):
        return force_text(('&nbsp;%s' % matchobj.group(1)))
    for i in range(count):
        value = re_widont.sub(replace, force_text(value))
    return value