def _parse_sig(sig, arg_names, validate=False):
    d = SIG_RE.match(sig)
    if not d:
        raise ValueError('Invalid method signature %s' % sig)
    d = d.groupdict()
    ret = [(n, Any) for n in arg_names]
    if 'args_sig' in d and type(
            d['args_sig']) is str and d['args_sig'].strip():
        for i, arg in enumerate(d['args_sig'].strip().split(',')):
            _type_checking_available(sig, validate)
            if '=' in arg:
                if not type(ret) is OrderedDict:
                    ret = OrderedDict(ret)
                dk = KWARG_RE.match(arg)
                if not dk:
                    raise ValueError('Could not parse arg type %s in %s' %
                                     (arg, sig))
                dk = dk.groupdict()
                if not sum(
                    [(k in dk and type(dk[k]) is str and bool(dk[k].strip()))
                         for k in ('arg_name', 'arg_type')]):
                    raise ValueError('Invalid kwarg value %s in %s' %
                                     (arg, sig))
                ret[dk['arg_name']] = _eval_arg_type(dk['arg_type'], None, arg,
                                                     sig)
            else:
                if type(ret) is OrderedDict:
                    raise ValueError('Positional arguments must occur '
                                     'before keyword arguments in %s' % sig)
                if len(ret) < i + 1:
                    ret.append((str(i), _eval_arg_type(arg, None, arg, sig)))
                else:
                    ret[i] = (ret[i][0], _eval_arg_type(arg, None, arg, sig))
    if not type(ret) is OrderedDict:
        ret = OrderedDict(ret)
    return (d['method_name'], ret,
            (_eval_arg_type(d['return_sig'], Any, 'return', sig) if
             d['return_sig'] else Any))
convert a synapse to JSON
dataset/ETHPy150Open samuraisam/django-json-rpc/jsonrpc/__init__.py/_parse_sig--crossover with--dataset/ETHPy150Open neurodata/ndstore/ocpca/jsonann.py/SynapsetoJSON