def _bytes_to_json(value):
 if isinstance(value, bytes):
  value = base64.encodestring(value)
 return value

def _bytes_to_json ( value ) : if isinstance ( value , bytes ) : value = base64 . encodestring ( value ) return value
coerce value to an json-compatible representation .