number of any default values for positional or keyword parameters

def _ndefs(f):
    '''
        number of any default values for positional or keyword parameters
    '''
    if isinstance(f, Function):
        return f.ndefs
    spec = inspect.getfullargspec(f)
    if spec.defaults is None:
        return 0
    return len(spec.defaults)