def _do(name, gnome_kwargs, preferences):
    '''
    worker function for the others to use
    this handles all the gsetting magic
    '''
    ret = {'name': name,
           'result': True,
           'changes': {},
           'comment': ''}

    messages = []

    for pref in preferences:
        key = pref
        value = preferences[pref]

        if isinstance(value, bool):
            ftype = 'boolean'

            # need to convert boolean values to strings and make lowercase to
            # pass to gsettings
            value = six.text_type(value).lower()

        elif isinstance(value, int):
            ftype = 'int'
        elif isinstance(value, six.string_types):
            ftype = 'string'
        else:
            ftype = 'string'

        gnome_kwargs.update({'key': key, 'value': value})

        if _check_current_value(gnome_kwargs, value):
            messages.append('{0} is already set to {1}'.format(key, value))
        else:
            result = __salt__['gnome.set'](**gnome_kwargs)
            if result['retcode'] == 0:
                messages.append('Setting {0} to {1}'.format(key, value))
                ret['changes'][key] = '{0}:{1}'.format(key, value)
                ret['result'] = True
            else:
                messages.append(result['stdout'])
                ret['result'] = False

        ret['comment'] = ', '.join(messages)

    return ret
def _do ( name , gnome_kwargs , preferences ) : ret = { 'name' : name , 'result' : True , 'changes' : { } , 'comment' : '' } messages = [ ] for pref in preferences : key = pref value = preferences [ pref ] if isinstance ( value , bool ) : ftype = 'boolean' value = six . text_type ( value ) . lower ( ) elif isinstance ( value , int ) : ftype = 'int' elif isinstance ( value , six . string_types ) : ftype = 'string' else : ftype = 'string' gnome_kwargs . update ( { 'key' : key , 'value' : value } ) if _check_current_value ( gnome_kwargs , value ) : messages . append ( '{0} is already set to {1}' . format ( key , value ) ) else : result = __salt__ [ 'gnome.set' ] ( ** gnome_kwargs ) if result [ 'retcode' ] == 0 : messages . append ( 'Setting {0} to {1}' . format ( key , value ) ) ret [ 'changes' ] [ key ] = '{0}:{1}' . format ( key , value ) ret [ 'result' ] = True else : messages . append ( result [ 'stdout' ] ) ret [ 'result' ] = False ret [ 'comment' ] = ', ' . join ( messages ) return ret
worker function for the others to use
    this handles all the gsetting magic