docs: def get_pub_address(name, timeout=10, nameserver="localhost"):
      """Get the address of the publisher for a given publisher *name* from the
      nameserver on *nameserver* (localhost by default).
      """
  
      # Socket to talk to server
      socket = get_context().socket(REQ)
      try:
          socket.setsockopt(LINGER, timeout * 1000)
          socket.connect("tcp://" + nameserver + ":" + str(PORT))
          logger.debug('Connecting to %s',
                       "tcp://" + nameserver + ":" + str(PORT))
          poller = Poller()
          poller.register(socket, POLLIN)
  
          message = Message("/oper/ns", "request", {"service": name})
          socket.send_string(six.text_type(message))
  
          # Get the reply.
          sock = poller.poll(timeout=timeout * 1000)
          if sock:
              if sock[0][0] == socket:
                  message = Message.decode(socket.recv_string(NOBLOCK))
                  return message.data
          else:
              raise TimeoutError("Didn't get an address after %d seconds."
                                 % timeout)
      finally:
          socket.close()