code: def decode_dict_keys_to_str(src):
      '''
      Convert top level keys from bytes to strings if possible.
      This is necessary because Python 3 makes a distinction
      between these types.
      '''
      if not six.PY3 or not isinstance(src, dict):
          return src
  
      output = {}
      for key, val in six.iteritems(src):
          if isinstance(key, bytes):
              try:
                  key = key.decode()
              except UnicodeError:
                  pass
          output[key] = val
      return outpuf decode_dict_keys_to_str(src):
      '''
      Convert top level keys from bytes to strings if possible.
      This is necessary because Python 3 makes a distinction
      between these types.
      '''
      if not six.PY3 or not isinstance(src, dict):
          return src
  
      output = {}
      for key, val in six.iteritems(src):
          if isinstance(key, bytes):
              try:
                  key = key.decode()
              except UnicodeError:
                  pass
          output[key] = val
      return output
docs: Convert top level keys from bytes to strings if possible.
      This is necessary because Python 3 makes a distinction
      between these types.