docs: def _compress(self, data, operation):
          """
          This private method compresses some data in a given mode. This is used
          because almost all of the code uses the exact same setup. It wouldn't
          have to, but it doesn't hurt at all.
          """
          # The 'algorithm' for working out how big to make this buffer is from
          # the Brotli source code, brotlimodule.cc.
          original_output_size = int(
              math.ceil(len(data) + (len(data) >> 2) + 10240)
          )
          available_out = ffi.new("size_t *")
          available_out[0] = original_output_size
          output_buffer = ffi.new("uint8_t []", available_out[0])
          ptr_to_output_buffer = ffi.new("uint8_t **", output_buffer)
          input_size = ffi.new("size_t *", len(data))
          input_buffer = ffi.new("uint8_t []", data)
          ptr_to_input_buffer = ffi.new("uint8_t **", input_buffer)
  
          rc = lib.BrotliEncoderCompressStream(
              self._encoder,
              operation,
              input_size,
              ptr_to_input_buffer,
              available_out,
              ptr_to_output_buffer,
              ffi.NULL
          )
          if rc != lib.BROTLI_TRUE:  # pragma: no cover
              raise Error("Error encountered compressing data.")
  
          assert not input_size[0]
  
          size_of_output = original_output_size - available_out[0]
          return ffi.buffer(output_buffer, size_of_output)[:]