docs: def to_buffer(self):
          """Returns an object that implements the buffer protocol for the value.
          It can be either the original value (on the numpy fast path), or a new
          temporary object.
          """
          value = self._transform_value()
          if self._fastpath != _FASTPATH_NUMPY:
              bit_length = self.itemsize_bits * self._num_elements()
              out = bytearray((bit_length + 7) // 8)
              gen = self._write_bits(out)
              gen.send(None)  # Initialise the generator
              # If it's a scalar, unpack it. That way, the input to the
              # final level of recursion in _store_recursive is always
              # the scalar rather than the 0D array.
              if len(self.shape) == 0:
                  value = value[()]
              self._store_recursive(len(self.shape), value, gen)
              gen.close()
              return out
          else:
              if self.order == 'F':
                  # numpy doesn't allow buffer protocol to be used on arrays that
                  # aren't C-contiguous, but transposition just fiddles the
                  # strides of the view without creating a new array.
                  value = value.transpose()
              return value