def dict_of_key_value_pairs(arg):
    lexer = shlex.shlex(arg)
    lexer.wordchars += '/.+-():'

    tokens = list(lexer)
    tokens_len = len(tokens)

    D = {}
    i = 0
    while i < tokens_len:
        k_eq_v = tokens[i:i+3]
        if len(k_eq_v) != 3 or k_eq_v[1] != '=':
            raise ValueError, "Unexpected end of key/value pairs"
        D[k_eq_v[0]] = k_eq_v[2].strip('\'"')
        i += 4
    return D
parse KEY=val,KEY2=val2 into {'KEY':'val', 'KEY2':'val2'}
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/datatypes.py/dict_of_key_value_pairs