human
Complete this python program:
def intersperse(string, counts, separator=''):
assistant
#Here is the Python program you requested.

    """See the asserts below for examples.
    """
    (left, rest, right) = intersperse_pat.match(string).groups()
    def reverse(s):
        return s[::(-1)]
    splits = split(reverse(rest), counts)
    res = separator.join(map(reverse, reverse(splits)))
    return (((left + res) + right), (((len(splits) > 0) and (len(splits) - 1)) or 0))