def validate_params(method, D):
    if type(D['params']) == Object:
        keys = method.json_arg_types.keys()
        if len(keys) != len(D['params']):
            raise InvalidParamsError('Not enough params provided for {0}' \
                .format(method.json_sig))
        for k in keys:
            if not k in D['params']:
                raise InvalidParamsError('{0} is not a valid parameter for {1}' \
                    .format(k, method.json_sig))
            if not Any.kind(D['params'][k]) == method.json_arg_types[k]:
                raise InvalidParamsError('{0} is not the correct type {1} for {2}' \
                    .format(type(D['params'][k]), method.json_arg_types[k], method.json_sig))
    elif type(D['params']) == Array:
        arg_types = list(method.json_arg_types.values())
        try:
            for i, arg in enumerate(D['params']):
                if not Any.kind(arg) == arg_types[i]:
                    raise InvalidParamsError('{0} is not the correct type {1} for {2}' \
                        .format(type(arg), arg_types[i], method.json_sig))
        except __HOLE__:
            raise InvalidParamsError('Too many params provided for {0}'.format(method.json_sig))
        else:
            if len(D['params']) != len(arg_types):
                raise InvalidParamsError('Not enough params provided for {0}'.format(method.json_sig))
dataset/ETHPy150Open cenobites/flask-jsonrpc/flask_jsonrpc/site.py/validate_params