def decode_image_data(data):
 try:
  return data.split(',')[1].decode('base64')
 except (IndexError, UnicodeEncodeError):
  log.exception('Could not decode image data')
  raise InvalidImageData

def decode_image_data ( data ) : try : return data . split ( ',' ) [ 1 ] . decode ( 'base64' ) except ( IndexError , UnicodeEncodeError ) : log . exception ( 'Could not decode image data' ) raise InvalidImageData
decode base64-encoded image data .