Generalize some code in church_astify in preparation for conditional (and future query-type functions)