code: def pool_memcached_connections(func):
      
      if isgeneratorfunction(func):
          def wrapper(*nargs, **kwargs):
              with memcached_client():
                  for result in func(*nargs, **kwargs):
                      yield result
      else:
          def wrapper(*nargs, **kwargs):
              with memcached_client():
                  return func(*nargs, **kwargs)
  
      return update_wrapper(wrapper, func)
docs: 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.