let opt_getd d = function
  | None -> d
  | Some x -> x