+def hide_volatile(obj, keys_with_volatiles=[]):
+ """
+ Takes list of keys with volatile values, and replaces them with generic "*"
+
+ :param obj: python dict from json
+ :param keys_with_volatiles: list of volatile keys
+ :return: corrected
+ """
+ if isinstance(obj, dict):
+ for key, value in obj.items():
+ # Unicode is not str and vice versa, isinstance has to check for both.
+ # Luckily, "in" recognizes equivalent strings in different encodings.
+ # Type "bytes" is added for Python 3 compatibility.
+ if key in keys_with_volatiles and isinstance(
+ value, (str, bytes, int, bool)
+ ):
+ obj[key] = "*"
+ else:
+ hide_volatile(value, keys_with_volatiles)
+ # A string is not a list, so there is no risk of recursion over characters.
+ elif isinstance(obj, list):
+ for item in obj:
+ hide_volatile(item, keys_with_volatiles)
+ return obj
+
+
+def normalize_json_text(
+ text,
+ strict=False,
+ indent=1,
+ keys_with_bits=[],
+ keys_with_volatiles=[],
+ jmes_path=None,
+):