let find_sexp annot_sexp sexp =
let rec loop annot_sexp =
match annot_sexp with
| Atom (_, sub_sexp)
| List (_, _, sub_sexp) when sexp == sub_sexp ->
raise (Annot_sexp annot_sexp)
| List (_, annots, _) -> List.iter loop annots
| Atom _ -> ()
in
try loop annot_sexp; None
with Annot_sexp res -> Some res