code: def _to_str(dumped_val, encoding='utf-8', ordered=True):
      
      _dict = OrderedDict if ordered else dict
      if isinstance(dumped_val, dict):
          return OrderedDict((k, _to_str(v, encoding)) for k,v in dumped_val.items())
      elif isinstance(dumped_val, (list, tuple)):
          return [_to_str(v, encoding) for v in dumped_val]
      elif isinstance(dumped_val, bytes):
          try:
              d = dumped_val.decode('utf-8')
          except Exception:
              d = repr(dumped_val)
          return d
      else:
          return dumped_val
docs: Convert bytes in a dump value to str, allowing json encode