def occupied(host, port, timeout=float('<STR_LIT>')):
if not host:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>timer = timing.Timer(timeout)<EOL>while not timer.expired():<EOL><INDENT>try:<EOL><INDENT>Checker(timeout=<NUM_LIT>).assert_free(host, port)<EOL>time.sleep(<NUM_LIT:0.1>)<EOL><DEDENT>except PortNotFree:<EOL><INDENT>return<EOL><DEDENT><DEDENT>raise Timeout("<STR_LIT>".format(**locals()))<EOL>
Wait for the specified port to become occupied (accepting requests).
Return when the port is occupied or raise a Timeout if timeout has
elapsed.

Timeout may be specified in seconds or as a timedelta.
If timeout is None or ∞, the routine will run indefinitely.

>>> occupied('localhost', find_available_local_port(), .1)
Traceback (most recent call last):
...
Timeout: Port ... not bound on localhost.