Strip `suffix` from the end of `text` if `text` has that suffix.

def strip_end(text, suffix):
    """Strip `suffix` from the end of `text` if `text` has that suffix."""
    if not text.endswith(suffix):
        return text
    return text[:len(text)-len(suffix)]