Decorator to run a function that requires the use of a docker.Client()
    instance.

def _docker_client(wrapped):
    '''
    Decorator to run a function that requires the use of a docker.Client()
    instance.
    '''
    @functools.wraps(wrapped)
    def wrapper(*args, **kwargs):
        '''
        Ensure that the client is present
        '''
        kwargs = __utils__['args.clean_kwargs'](**kwargs)
        timeout = kwargs.pop('client_timeout', NOTSET)
        if 'docker.client' not in __context__ \
                or not hasattr(__context__['docker.client'], 'timeout'):
            __context__['docker.client'] = _get_client(
                timeout=timeout, **kwargs)
        orig_timeout = None
        if timeout is not NOTSET \
                and hasattr(__context__['docker.client'], 'timeout') \
                and __context__['docker.client'].timeout != timeout:
            # Temporarily override timeout
            orig_timeout = __context__['docker.client'].timeout
            __context__['docker.client'].timeout = timeout
        ret = wrapped(*args, **kwargs)
        if orig_timeout is not None:
            __context__['docker.client'].timeout = orig_timeout
        return ret
    return wrapper