code: def is_invalid_params_py2(func, *args, **kwargs):
      
      funcargs, varargs, varkwargs, defaults = inspect.getargspec(func)
  
      unexpected = set(kwargs.keys()) - set(funcargs)
      if len(unexpected) > 0:
          return True
  
      params = [funcarg for funcarg in funcargs if funcarg not in kwargs]
      funcargs_required = funcargs[:-len(defaults)] \
          if defaults is not None \
          else funcargs
      params_required = [
          funcarg for funcarg in funcargs_required
          if funcarg not in kwargs
      ]
  
      return not (len(params_required) <= len(args) <= len(params))
docs: 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