def _arity(f):
 if (sys.version_info < (3,)):
  return len(inspect.getargspec(f)[0])
 else:
  param = inspect.signature(f).parameters.values()
  return len([p for p in param if (p.kind == p.POSITIONAL_OR_KEYWORD)])

def _arity ( f ) : if ( sys . version_info < ( 3 , ) ) : return len ( inspect . getargspec ( f ) [ 0 ] ) else : param = inspect . signature ( f ) . parameters . values ( ) return len ( [ p for p in param if ( p . kind == p . POSITIONAL_OR_KEYWORD ) ] )
python 2 and 3 compatible version that do not raise a deprecation warning .