docs: def make_fake_data(g, fac=1.0):
      """ Make fake data based on ``g``.
  
      This function replaces the |GVar|\s in ``g`` by  new |GVar|\s with similar
      means and a similar covariance matrix, but multiplied by ``fac**2`` (so
      standard deviations are ``fac`` times smaller). The changes are random.
      The function was designed to create fake data for testing fitting
      routines, where ``g`` is set equal to ``fitfcn(x, prior)`` and ``fac<1``
      (e.g.,  set ``fac=0.1`` to get fit parameters whose standard deviations
      are  10x smaller than those of the corresponding priors).
  
      Args:
          g (dict, array or gvar.GVar): The |GVar| or array of |GVar|\s,
              or dictionary whose values are |GVar|\s or arrays of |GVar|\s that
              from which the fake data is generated.
  
          fac (float): Uncertainties are rescaled by ``fac`` in the fake data.
  
      Returns:
          A collection of |GVar|\s with the same layout as ``g`` but with
          somewhat different means, and standard deviations rescaled by ``fac``.
      """
      if hasattr(g, 'keys'):
          if not isinstance(g, BufferDict):
              g = BufferDict(g)
          return BufferDict(g, buf=make_fake_data(g.buf, fac))
      else:
          g_shape = numpy.shape(g)
          g_flat = numpy.array(g).flat
          zero = numpy.zeros(len(g_flat), float)
          dg = (2. ** -0.5) * gvar(zero, evalcov(g_flat))
          dg *= fac
          noise = gvar(zero, sdev(dg))
          g_flat = mean(g_flat) + dg + noise + next(raniter(dg + noise))
          return g_flat[0] if g_shape == () else g_flat.reshape(g_shape)