docs: def _execute(job, f, o=None):
      """
      Executes a librsync "job" by reading bytes from `f` and writing results to
      `o` if provided. If `o` is omitted, the output is ignored.
      """
      # Re-use the same buffer for output, we will read from it after each
      # iteration.
      out = ctypes.create_string_buffer(RS_JOB_BLOCKSIZE)
      while True:
          block = f.read(RS_JOB_BLOCKSIZE)
          buff = Buffer()
          # provide the data block via input buffer.
          buff.next_in = ctypes.c_char_p(block)
          buff.avail_in = ctypes.c_size_t(len(block))
          buff.eof_in = ctypes.c_int(not block)
          # Set up our buffer for output.
          buff.next_out = ctypes.cast(out, ctypes.c_char_p)
          buff.avail_out = ctypes.c_size_t(RS_JOB_BLOCKSIZE)
          r = _librsync.rs_job_iter(job, ctypes.byref(buff))
          if o:
              o.write(out.raw[:RS_JOB_BLOCKSIZE - buff.avail_out])
          if r == RS_DONE:
              break
          elif r != RS_BLOCKED:
              raise LibrsyncError(r)
          if buff.avail_in > 0:
              # There is data left in the input buffer, librsync did not consume
              # all of it. Rewind the file a bit so we include that data in our
              # next read. It would be better to simply tack data to the end of
              # this buffer, but that is very difficult in Python.
              f.seek(f.tell() - buff.avail_in)
      if o and callable(getattr(o, 'seek', None)):
          # As a matter of convenience, rewind the output file.
          o.seek(0)
      return o