Check, whether function 'func' accepts parameters 'args', 'kwargs'.

    NOTE: Method is called after funct(*args, **kwargs) generated TypeError,
    it is aimed to destinguish TypeError because of invalid parameters from
    TypeError from inside the function.

    .. versionadded: 1.9.0

def is_invalid_params(func, *args, **kwargs):
    """ Check, whether function 'func' accepts parameters 'args', 'kwargs'.

    NOTE: Method is called after funct(*args, **kwargs) generated TypeError,
    it is aimed to destinguish TypeError because of invalid parameters from
    TypeError from inside the function.

    .. versionadded: 1.9.0

    """
    # For builtin functions inspect.getargspec(funct) return error. If builtin
    # function generates TypeError, it is because of wrong parameters.
    if not inspect.isfunction(func):
        return True

    funcargs, varargs, varkwargs, defaults = inspect.getargspec(func)
    if defaults:
        funcargs = funcargs[:-len(defaults)]

    if args and len(args) != len(funcargs):
            return True
    if kwargs and set(kwargs.keys()) != set(funcargs):
        return True

    if not args and not kwargs and funcargs:
        return True

    return False