let with_buffer ?(size = 42) f =   let b = Buffer.create 42 in   let str = Buffer.add_string b in   let res = f str in   Buffer.contents b, res