def multireplace(text, replacements, start=0, stop=None, join=join,
    joinlist=joinlist):
    """ Apply multiple replacement to a text at once.

        replacements must be list of tuples (replacement, left,
        right).  It is used to replace the slice text[left:right] with_what
        the string replacement.

        Note that the replacements do not affect one another.  Indices
        always refer to the original text string.

        Replacements must not overlap. Otherwise a ValueError is
        raised.

    """
    if stop is not None:
        return join(joinlist(text, replacements, start, stop))
    else:
        return join(joinlist(text, replacements, start))
