code: void performTearDownChecks(final ITemplateEnd itemplateEnd) {
  
          if (this.modelController.getModelLevel() != 0) {
              throw new TemplateProcessingException(
                      "Bad markup or template processing sequence. Model level is != 0 (" + this.modelController.getModelLevel() + ") " +
                      "at template end.", itemplateEnd.getTemplateName(), itemplateEnd.getLine(), itemplateEnd.getCol());
          }
          if (this.engineContext != null) {
              if (this.engineContext.level() != this.initialContextLevel.intValue()) {
                  throw new TemplateProcessingException(
                          "Bad markup or template processing sequence. Context level after processing (" + this.engineContext.level() + ") " +
                          "does not correspond to context level before processing (" + this.initialContextLevel.intValue() + ").",
                          itemplateEnd.getTemplateName(), itemplateEnd.getLine(), itemplateEnd.getCol());
              }
              final List<IProcessableElementTag> elementStack = this.engineContext.getElementStackAbove(this.initialContextLevel.intValue());
              if (!elementStack.isEmpty()) {
                  throw new TemplateProcessingException(
                          "Bad markup or template processing sequence. Element stack after processing is not empty: " +
                          elementStack, itemplateEnd.getTemplateName(), itemplateEnd.getLine(), itemplateEnd.getCol());
              }
          }
  
      }
docs: /*
  Asserts to be executed at the end of template processing for making sure all hierarchical indexes have finally
  returned to their initial position (which means nothing wrong has happened during model or context processing).