_classes_for_gen_func() and _id_for_gen_func() don't take sparse, so I put sparse at the end.  It doesn't really matter.