def parse_arg_line(fargs):
    """parse limited form of arguments of function

    in the form a=1, b='c'
    as a dictionary
    """

    # Convert to literal dict
    fargs = fargs.strip()
    if fargs == '':
        return {}

    pairs = [s.strip() for s in fargs.split(',')]
    # find first "="
    result = []
    for p in pairs:
        fe = p.find("=")
        if fe == -1:
            # no equal
            raise ValueError("malformed")
        key = p[:fe]
        val = p[fe + 1:]
        tok = "'{}': {}".format(key, val)
        result.append(tok)
    tokj = ','.join(result)
    result = "{{ {0} }}".format(tokj)
    state = ast.literal_eval(result)
    return state
def parse_arg_line ( fargs ) : fargs = fargs . strip ( ) if fargs == '' : return { } pairs = [ s . strip ( ) for s in fargs . split ( ',' ) ] result = [ ] for p in pairs : fe = p . find ( "=" ) if fe == - 1 : raise ValueError ( "malformed" ) key = p [ : fe ] val = p [ fe + 1 : ] tok = "'{}': {}" . format ( key , val ) result . append ( tok ) tokj = ',' . join ( result ) result = "{{ {0} }}" . format ( tokj ) state = ast . literal_eval ( result ) return state
parse limited form of arguments of function

    in the form a=1, b='c'
    as a dictionary