code: def c_func(funcname, reverse=False, nans=False, scalar=False):
      
      varnames = ['group_idx', 'a', 'ret', 'counter']
      codebase = c_base_reverse if reverse else c_base
      iteration = c_iter_scalar[funcname] if scalar else c_iter[funcname]
      if scalar:
          varnames.remove('a')
      return codebase % dict(init=c_init(varnames), iter=iteration,
                             finish=c_finish.get(funcname, ''),
                             ri_redir=(c_ri_redir if nans else c_ri))
docs: Fill c_funcs with constructed code from the templates