def suffix_eq(text, pos, expected):
    """Check if the suffix of text starting at pos equals expected.

    This is effectively equivalent to ``text[pos:] == expected``, but avoids
    allocating a huge substring.

    If ``pos`` is 0, this is equal to ``text == expected``.

    :param str text: Text to compare.
    :param int pos: Starting position for the suffix.
    :param str expected: String to compare to.
    """
    if not pos:
        return text == expected
    return (len(text) - pos == len(expected) and
            all(text[i + pos] == expected[i] for i in range(len(expected))))