code: 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.defaultsf _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)
docs: number of any default values for positional or keyword parameters