def send_packet(self, conn_id, buf):
        """
        Queue data to be sent over the link.

        :return: packet id
        """
        assert type(buf) == bytes
        try:
            conn = self._connections[conn_id]
        except __HOLE__:
            raise NoConnection

        self._last_packet_id += 1
        packet_id = self._last_packet_id

        buf = size_to_bin(len(buf)) + buf
        conn.send_buffer.put(buf)
        conn.queued_packet_ids.append((len(buf), packet_id))
        self._send_to_link(conn_id, conn)

        return packet_id

    ###########################################################
    ###########################################################
dataset/ETHPy150Open dsiroky/snakemq/snakemq/packeter.py/Packeter.send_packet