'Buffer received data, find TERMINATOR, call handle_packet'

def data_received(self, data):

    self.buffer.extend(data)
    while (self.TERMINATOR in self.buffer):
        (packet, self.buffer) = self.buffer.split(self.TERMINATOR, 1)
        self.handle_packet(packet)
