let ksbprintf g fmt = let buff = Buffer.create 42 in let f = formatter_of_buffer buff in kfprintf (fun f -> (pp_print_flush f (); g (Buffer.contents buff))) f fmt