def rreplace(edit, old, new, count=-1):
    """
    Python lacks a reverse replace function for strings so here is one.
    """
    # Not using str.replace in our rreplace as this is (allegedly) fastest.
    return new.join(edit.rsplit(old, count))