docs: def _check_buffer(self, data, ctype):
          """Convert buffer to cdata and check for valid size."""
          assert ctype in _ffi_types.values()
          if not isinstance(data, bytes):
              data = _ffi.from_buffer(data)
          frames, remainder = divmod(len(data),
                                     self.channels * _ffi.sizeof(ctype))
          if remainder:
              raise ValueError("Data size must be a multiple of frame size")
          return data, frames