Support various versions of python-zmq (fix for #13508)

Looks like the api for determining if a socket is in a poller varies from python-zmq version to version. In my version (14.0.1) you cah do "socket in poller", it seems that older versions don't support that. So, to be compatible i've stolen the code from destroy()
Merge pull request #13540 from jacksontj/develop

Support various versions of python-zmq (fix for #13508)