def _decode_embedded_dict(src):
 output = {}
 for (key, val) in six.iteritems(src):
  if isinstance(val, dict):
   val = _decode_embedded_dict(val)
  elif isinstance(val, list):
   val = _decode_embedded_list(val)
  elif isinstance(val, bytes):
   try:
    val = val.decode()
   except UnicodeError:
    pass
  if isinstance(key, bytes):
   try:
    key = key.decode()
   except UnicodeError:
    pass
  output[key] = val
 return output

def _decode_embedded_dict ( src ) : output = { } for ( key , val ) in six . iteritems ( src ) : if isinstance ( val , dict ) : val = _decode_embedded_dict ( val ) elif isinstance ( val , list ) : val = _decode_embedded_list ( val ) elif isinstance ( val , bytes ) : try : val = val . decode ( ) except UnicodeError : pass if isinstance ( key , bytes ) : try : key = key . decode ( ) except UnicodeError : pass output [ key ] = val return output
convert enbedded bytes to strings if possible .