<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

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