docs: def _reformat(p, buf):
      """ Apply format of ``p`` to data in 1-d array ``buf``. """
      if numpy.ndim(buf) != 1:
          raise ValueError("Buffer ``buf`` must be 1-d.")
      if hasattr(p, 'keys'):
          ans = _gvar.BufferDict(p)
          if ans.size != len(buf):
              raise ValueError(       #
                  "p, buf size mismatch: %d, %d"%(ans.size, len(buf)))
          ans = _gvar.BufferDict(ans, buf=buf)
      else:
          if numpy.size(p) != len(buf):
              raise ValueError(       #
                  "p, buf size mismatch: %d, %d"%(numpy.size(p), len(buf)))
          ans = numpy.array(buf).reshape(numpy.shape(p))
      return ans