code: def discover(name, wait_for_s=60):
      
      _start_beacon()
      #
      # It's possible to enter a deadlock situation where the first
      # process fires off a discovery request and waits for the
      # second process to advertise. But the second process has to
      # connect to the rpc port of the first process' beacon and
      # its advertisement is queued behind the pending discovery.
      #
      # To give both a chance of succeeding we operate in bursts,
      # allowing them to interleave.
      #
      t0 = time.time()
      while True:
          discovery = _rpc("discover", name, 0.5)
          if discovery:
              return discovery
          if timed_out(t0, wait_for_s):
              return None
docs: Discover a service by name
      
      Look for an advert to a named service::
      
          address = nw0.discover("myservice")
          
      :param name: any text
      :param wait_for_s: how many seconds to wait before giving up
      :returns: the address found or None