def METHOD_NAME(self, request, class_pre_upgrade_data, class_target_sat):
    @request.addfinalizer
    def _cleanup():
        puppet_class = getattr(
            class_pre_upgrade_data, next(iter(class_pre_upgrade_data))
        ).puppet_class
        class_target_sat.delete_puppet_class(puppet_class)