docs: def make_rfft_factors(axes, resshape, facshape, normshape, norm):
      """ make the compression factors and compute the normalization
          for irfft and rfft.
      """
      N = 1.0
      for n in normshape: N = N * n
  
      # inplace modification is fine because we produce a constant
      # which doesn't go into autograd.
      # For same reason could have used numpy rather than anp.
      # but we already imported anp, so use it instead.
      fac = anp.zeros(resshape)
      fac[...] = 2
      index = [slice(None)] * len(resshape)
      if facshape[-1] <= resshape[axes[-1]]:
          index[axes[-1]] = (0, facshape[-1] - 1)
      else:
          index[axes[-1]] = (0,)
      fac[tuple(index)] = 1
      if norm is None:
          fac /= N
      return fac