code: def socket_ready(hostport):
      
      if hasattr(hostport, 'startswith'):
          # string representation of the hostport combination
          if hostport.startswith('tcp://'):
              hostport = hostport[6:]  # strip tcp://
          host, port = hostport.split(':')
          hostport = (host, int(port))
      sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      try:
          exc = sock.connect_ex(hostport)
      finally:
          sock.close()
      return False if exc else True
docs: :param hostport: a pair (host, port) or a string (tcp://)host:port
      :returns: True if the socket is ready and False otherwise