'poll the socket for events
The default is to poll forever for incoming
events.  Timeout is in milliseconds, if specified.
Parameters
timeout : int [default: None]
The timeout (in milliseconds) to wait for an event. If unspecified
(or specified None), will wait forever for an event.
flags : bitfield (int) [default: POLLIN]
The event flags to poll for (any combination of POLLIN|POLLOUT).
The default is to check for incoming events (POLLIN).
Returns
events : bitfield (int)
The events that are ready and waiting.  Will be 0 if no events were ready
by the time timeout was reached.'

def poll(self, timeout=None, flags=POLLIN):

    if self.closed:
        raise ZMQError(ENOTSUP)
    p = self._poller_class()
    p.register(self, flags)
    evts = dict(p.poll(timeout))
    return evts.get(self, 0)
