def _collapse(word, max_stretch):
    """Collapse stretches of single letters in a word that exceed a certain
    length.

    :arg str word: Non empty input string.
    :arg int max_stretch: Maximum stretch of single letters, must be larger
        than 1.

    :return tuple(str, int): The collapsed word and the number of collapsed
        stretches.
    """
    stretch = 0
    collapsed_word = word[0]
    number_of_collapses = 0
    for i in range(1, len(word)):
        if word[i - 1] == word[i]:
            stretch += 1
        else:
            stretch = 0
        if stretch < max_stretch:
            collapsed_word += word[i]
        if stretch == max_stretch:
            number_of_collapses += 1
    return collapsed_word, number_of_collapses
