def _serialize_buffer(buffer, array_serialization=None):
 if (array_serialization == 'binary'):
  return buffer.ravel().tostring()
 elif (array_serialization == 'base64'):
  return {'storage_type': 'base64', 'buffer': base64.b64encode(buffer).decode('ascii')}
 raise ValueError("The array serialization method should be 'binary' or 'base64'.")

def _serialize_buffer ( buffer , array_serialization = None ) : if ( array_serialization == 'binary' ) : return buffer . ravel ( ) . tostring ( ) elif ( array_serialization == 'base64' ) : return { 'storage_type' : 'base64' , 'buffer' : base64 . b64encode ( buffer ) . decode ( 'ascii' ) } raise ValueError ( "The array serialization method should be 'binary' or 'base64'." )
serialize a numpy array .