def _set_value(value):
    '''
    A function to detect if user is trying to pass a dictionary or list.  parse it and return a
    dictionary list or a string
    '''
    #don't continue if already an acceptable data-type
    if isinstance(value, bool) or isinstance(value, dict) or isinstance(value, list):
        return value

    #check if json
    if value.startswith('j{') and value.endswith('}j'):

        value = value.replace('j{', '{')
        value = value.replace('}j', '}')

        try:
            return salt.utils.json.loads(value)
        except Exception:
            raise salt.exceptions.CommandExecutionError

    #detect list of dictionaries
    if '|' in value and r'\|' not in value:
        values = value.split('|')
        items = []
        for value in values:
            items.append(_set_value(value))
        return items

    #parse out dictionary if detected
    if ':' in value and r'\:' not in value:
        options = {}
        #split out pairs
        key_pairs = value.split(',')
        for key_pair in key_pairs:
            k = key_pair.split(':')[0]
            v = key_pair.split(':')[1]
            options[k] = v
        return options

    #try making a list
    elif ',' in value and r'\,' not in value:
        value_items = value.split(',')
        return value_items

    #just return a string
    else:

        #remove escape chars if added
        if r'\|' in value:
            value = value.replace(r'\|', '|')

        if r'\:' in value:
            value = value.replace(r'\:', ':')

        if r'\,' in value:
            value = value.replace(r'\,', ',')

        return value
def _set_value ( value ) : if isinstance ( value , bool ) or isinstance ( value , dict ) or isinstance ( value , list ) : return value if value . startswith ( 'j{' ) and value . endswith ( '}j' ) : value = value . replace ( 'j{' , '{' ) value = value . replace ( '}j' , '}' ) try : return salt . utils . json . loads ( value ) except Exception : raise salt . exceptions . CommandExecutionError if '|' in value and r'\|' not in value : values = value . split ( '|' ) items = [ ] for value in values : items . append ( _set_value ( value ) ) return items if ':' in value and r'\:' not in value : options = { } key_pairs = value . split ( ',' ) for key_pair in key_pairs : k = key_pair . split ( ':' ) [ 0 ] v = key_pair . split ( ':' ) [ 1 ] options [ k ] = v return options elif ',' in value and r'\,' not in value : value_items = value . split ( ',' ) return value_items else : if r'\|' in value : value = value . replace ( r'\|' , '|' ) if r'\:' in value : value = value . replace ( r'\:' , ':' ) if r'\,' in value : value = value . replace ( r'\,' , ',' ) return value
A function to detect if user is trying to pass a dictionary or list.  parse it and return a
    dictionary list or a string