def pool_memcached_connections(func):
if isgeneratorfunction(func):<EOL><INDENT>def wrapper(*nargs, **kwargs):<EOL><INDENT>with memcached_client():<EOL><INDENT>for result in func(*nargs, **kwargs):<EOL><INDENT>yield result<EOL><DEDENT><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>def wrapper(*nargs, **kwargs):<EOL><INDENT>with memcached_client():<EOL><INDENT>return func(*nargs, **kwargs)<EOL><DEDENT><DEDENT><DEDENT>return update_wrapper(wrapper, func)<EOL>
Function decorator to pool memcached connections.

    Use this to wrap functions that might make multiple calls to memcached. This
    will cause a single memcached client to be shared for all connections.