'Decorate a message with a reply attribute, and send it to the master.
Then wait for a response.
Raises:
exceptions.Kill: All connections should be closed immediately.'

def ask(self, mtype, m):

    m.reply = Reply(m)
    self.q.put((mtype, m))
    while (not self.should_exit.is_set()):
        try:
            g = m.reply.q.get(timeout=0.5)
        except queue.Empty:
            continue
        if (g == exceptions.Kill):
            raise exceptions.Kill()
        return g
    m.reply._state = 'committed'
    raise exceptions.Kill()
