'Return a connected PAIR socket ready to receive the event notifications.
.. versionadded:: libzmq-4.0
.. versionadded:: 14.0
Parameters
events : bitfield (int) [default: ZMQ_EVENTS_ALL]
The bitmask defining which events are wanted.
addr :  string [default: None]
The optional endpoint for the monitoring sockets.
Returns
socket :  (PAIR)
The socket is already connected and ready to receive messages.'

def get_monitor_socket(self, events=None, addr=None):

    if (zmq.zmq_version_info() < (4,)):
        raise NotImplementedError(('get_monitor_socket    requires    libzmq    >=    4,    have    %s' % zmq.zmq_version()))
    if self._monitor_socket:
        if self._monitor_socket.closed:
            self._monitor_socket = None
        else:
            return self._monitor_socket
    if (addr is None):
        addr = ('inproc://monitor.s-%d' % self.FD)
    if (events is None):
        events = zmq.EVENT_ALL
    self.monitor(addr, events)
    self._monitor_socket = self.context.socket(zmq.PAIR)
    self._monitor_socket.connect(addr)
    return self._monitor_socket
