<s> from __future__ import absolute_import , print_function <EOL> import contextlib <EOL> import kazoo . client <EOL> import kazoo . exceptions <EOL> import kazoo . handlers . threading <EOL> from . import log <EOL> TIMEOUT = <NUM_LIT:1> <EOL> client_class = kazoo . client . KazooClient <EOL> @ contextlib . contextmanager <EOL> def client ( * args , ** kwargs ) : <EOL> zk = client_class ( * args , ** kwargs ) <EOL> try : <EOL> zk . start ( timeout = TIMEOUT ) <EOL> except kazoo . handlers . threading . TimeoutError : <EOL> log . fatal ( <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" ) <EOL> try : <EOL> yield zk <EOL> finally : <EOL> zk . stop ( ) <EOL> zk . close ( ) </s>
