code: def _decode_v2(value):
      
      if re.search(r'(?<!\$):', value):
          raise ValueError("Unescaped ':' in the encoded string")
  
      decode_colons = value.replace('$:', ':')
  
      if re.search(r'(?<!\$)(\$\$)*\$([^$]|\Z)', decode_colons):
          raise ValueError("Unescaped '$' in encoded string")
      return decode_colons.replace('$$', '$')
docs: Decode ':' and '$' characters encoded by `_encode`.