def _decode_v1(value):
    """
    Decode '::' and '$' characters encoded by `_encode`.
    """
    decode_colons = value.replace('$::', '::')
    decode_dollars = decode_colons.replace('$$', '$')

    reencoded = _encode_v1(decode_dollars)
    if reencoded != value:
        raise ValueError('Ambiguous encoded value, {!r} could have been encoded as {!r}'.format(value, reencoded))

    return decode_dollars
Decode '::' and '$' characters encoded by `_encode`.