Internal helper to pop a message off the receive buffer.  If
        the message is an Exception, that exception will be raised;
        otherwise, a tuple of command and payload will be returned.

def _recvbuf_pop(self):
        """
        Internal helper to pop a message off the receive buffer.  If
        the message is an Exception, that exception will be raised;
        otherwise, a tuple of command and payload will be returned.
        """

        # Pop a message off the recv buffer and return (or raise) it
        msg = self._recvbuf.pop(0)
        if isinstance(msg, Exception):
            raise msg
        return msg['cmd'], msg['payload']