def rreplace(s, old, new, occurrence=-1):
    """
    Replace old with new starting from end of the string
    :param s: The string to be transformed
    :param old: Search string
    :param new: Replacement string
    :param occurrence: Number of replacements to do
    :return:
    """
    li = s.rsplit(old, occurrence)
    return new.join(li)