'Writes an entire "mysql packet" in its entirety to the network
addings its length and sequence number.'

def write_packet(self, payload):

    data = ((pack_int24(len(payload)) + int2byte(self._next_seq_id)) + payload)
    if DEBUG:
        dump_packet(data)
    self._write_bytes(data)
    self._next_seq_id = ((self._next_seq_id + 1) % 256)
