def _flatten_bytestring(self, obj):
    if PY2:
        try:
            return obj.decode('utf-8')
        except UnicodeDecodeError:
            pass
    return {self._bytes_tag: self._bytes_encoder(obj)}
def _flatten_bytestring(self, obj):
    if PY2:
        try:
            return obj.decode('utf-8')
        except UnicodeDecodeError:
            pass
    return {self._bytes_tag: self._bytes_encoder(obj)}