+ unwanted_fields = [u"count", u"index", u"context"]
+
+ def process_value(val):
+ """Process value.
+
+ :param val: Value to be processed.
+ :type val: object
+ :returns: Processed value.
+ :rtype: dict or str or int
+ """
+ if isinstance(val, dict):
+ for val_k, val_v in val.items():
+ val[str(val_k)] = process_value(val_v)
+ return val
+ elif isinstance(val, list):
+ for idx, val_l in enumerate(val):
+ val[idx] = process_value(val_l)
+ return val
+ elif isinstance(val, bytes):
+ val.hex()
+ elif hasattr(val, u"__int__"):
+ return int(val)
+ elif hasattr(val, "__str__"):
+ return str(val).encode(encoding=u"utf-8").hex()
+ # Next handles parameters not supporting preferred integer or string
+ # representation to get it logged
+ elif hasattr(val, u"__repr__"):
+ return repr(val)
+ else:
+ return val