def _split_last(s, sub):
    """Splits string `s` at the last occurrence of substring `sub` and returns a
    tuple of the form (left, right)."""

    return (sub.join(s.split(sub)[:-1]), s.split(sub)[-1])