@staticmethod<EOL><INDENT>def discover(name, timeout=None, minimum_providers=<NUM_LIT:1>):<DEDENT>
start = time.time()<EOL>endtime = timeout if timeout else <NUM_LIT:0><EOL>while True:<EOL><INDENT>timed_out = time.time() - start > endtime<EOL>if name in services and isinstance(services[name], list):<EOL><INDENT>if len(services[name]) >= minimum_providers or timed_out:<EOL><INDENT>providers = services[name]<EOL>if providers:<EOL><INDENT>return Service(name, providers)<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT><DEDENT><DEDENT>if timed_out:<EOL><INDENT>break<EOL><DEDENT>time.sleep(<NUM_LIT>)  <EOL><DEDENT>return None<EOL>
discovers a service. If timeout is specified, waits for at least minimum_providers service instance to be available.
Note : we do not want to make the discovery block undefinitely since we never know for sure if a service is running or not
TODO : improve with future...
:param name: name of the service
:param timeout: maximum number of seconds the discover can wait for a discovery matching requirements. if None, doesn't wait.
:param minimum_providers the number of provider we need to reach before discover() returns if timeout enabled
:return: a Service object, containing the list of providers. if the minimum number cannot be reached, still returns what is available.