def rreplace(s, old, new, count=None):
    """
    Replace instances of `old` in `s` with `new`, starting from the right.
    
    This function is to `str.replace` what `str.rsplit` is to `str.split`.
    """
    return new.join(s.rsplit(old, count) if count is not None else s.rsplit
        (old))
