def createProtocolMessages(data, flags=const.FLAG_PAYLOAD):
 messages = []
 while (len(data) > const.MPU):
  messages.append(ProtocolMessage(data[:const.MPU], flags=flags))
  data = data[const.MPU:]
 messages.append(ProtocolMessage(data, flags=flags))
 return messages

def createProtocolMessages ( data , flags = const . FLAG_PAYLOAD ) : messages = [ ] while ( len ( data ) > const . MPU ) : messages . append ( ProtocolMessage ( data [ : const . MPU ] , flags = flags ) ) data = data [ const . MPU : ] messages . append ( ProtocolMessage ( data , flags = flags ) ) return messages
create protocol messages out of the given payload .