Small decorator to makes sure that the mount and umount happends in
    a transactional way.

def __mount_device(action):
    '''
    Small decorator to makes sure that the mount and umount happends in
    a transactional way.
    '''
    @functools.wraps(action)
    def wrapper(*args, **kwargs):
        name = kwargs['name']
        device = kwargs['device']

        ret = {
            'name': name,
            'result': False,
            'changes': {},
            'comment': ['Some error happends during the operation.'],
        }
        try:
            dest = _mount(device)
            if not dest:
                msg = 'Device {} cannot be mounted'.format(device)
                ret['comment'].append(msg)
            kwargs['__dest'] = dest
            ret = action(*args, **kwargs)
        except Exception as e:
            log.exception('Encountered error mounting %s', device)
            ret['comment'].append(six.text_type(e))
        finally:
            _umount(dest)
        return ret
    return wrapper