code: def _generic_callable(group_idx, a, size, fill_value, dtype=None,
                        func=lambda g: g, **kwargs):
      
      groups = _array(group_idx, a, size, ())
      ret = np.full(size, fill_value, dtype=dtype or np.float64)
  
      for i, grp in enumerate(groups):
          if np.ndim(grp) == 1 and len(grp) > 0:
              ret[i] = func(grp)
      return ret
docs: groups a by inds, and then applies foo to each group in turn, placing
      the results in an array.