Check Python ASTs against templates