let check_and_remove_extension filename ~ext = if Filename.check_suffix filename ext then Some (Filename.chop_suffix filename ext) else None