def _function_has_n_args(self, func, n):
        """
        Returns true if func has n arguments. Arguments with default and self for
        methods are not considered.
        """
        if inspect.ismethod(func):
            n += 1

        argspec = inspect.getargspec(func)
        defaults = argspec.defaults or ()

        return len(argspec.args) - len(defaults) == n
def _function_has_n_args ( self , func , n ) : if inspect . ismethod ( func ) : n += 1 argspec = inspect . getargspec ( func ) defaults = argspec . defaults or ( ) return len ( argspec . args ) - len ( defaults ) == n
Returns true if func has n arguments. Arguments with default and self for
        methods are not considered.