def align(self, sequence):
    (header, req_id) = self._new_id()
    bname = 'align'.encode('utf-8')
    bargs = self.packb([sequence.decode()])
    bkwargs = self.packb(dict())
    msg = [header, bname, bargs, bkwargs]
    self.sock.send_multipart(msg)
    while True:
        try:
            data = self.sock.recv_multipart(zmq.NOBLOCK)
        except zmq.ZMQError as e:
            time.sleep(0.1)
        else:
            (header, banswer) = data
            (pid, rnd, res_req_id, timestamp, is_error) = self.RESP.unpack(header)
            if (res_req_id != req_id):
                raise ValueError('Received response for request {}, but send {}.'.format(res_res_id, req_id))
            answer = self.unpackb(banswer)
            return answer
def align(self, sequence):
    (header, req_id) = self._new_id()
    bname = 'align'.encode('utf-8')
    bargs = self.packb([sequence.decode()])
    bkwargs = self.packb(dict())
    msg = [header, bname, bargs, bkwargs]
    self.sock.send_multipart(msg)
    while True:
        try:
            data = self.sock.recv_multipart(zmq.NOBLOCK)
        except zmq.ZMQError as e:
            time.sleep(0.1)
        else:
            (header, banswer) = data
            (pid, rnd, res_req_id, timestamp, is_error) = self.RESP.unpack(header)
            if (res_req_id != req_id):
                raise ValueError('Received response for request {}, but send {}.'.format(res_res_id, req_id))
            answer = self.unpackb(banswer)
            return answer