This section is a bit difficult to comprehend without knowing the ZMQ data structures - it's worth a few comments to say that answer is a dictionary of sockets, that msg[0] is the name of the stat, and so on.