based on our experience of customizing traversals for sample applications section we build support into the primary eulertour for maintaining the recursive depth and the representation of the recursive path through treeusing the approach that we introduced in code fragment we also provide mechanism for one recursive level to return value to another when post-processing formallyour framework relies on the following two hooks that can be specializedmethod hook previsit(pdpaththis function is called once for each positionimmediately before its subtrees (if anyare traversed parameter is position in the treed is the depth of that positionand path is list of indicesusing the convention described in the discussion of code fragment no return value is expected from this function method hook postvisit(pdpathresultsthis function is called once for each positionimmediately after its subtrees (if anyare traversed the first three parameters use the same convention as did hook previsit the final parameter is list of objects that were provided as return values from the post visits of the respective subtrees of any value returned by this call will be available to the parent of during its postvisit for more complex taskssubclasses of eulertour may also choose to initialize and maintain additional state in the form of instance variables that can be accessed within the bodies of the hooks using the euler tour framework to demonstrate the flexibility of our euler tour frameworkwe revisit the sample applications from section as simple examplean indented preorder traversalakin to that originally produced by code fragment can be generated with the simple subclass given in code fragment class preorderprintindentedtour(eulertour) def hook previsit(selfpdpath)str( element)) print( code fragment subclass of eulertour that produces an indented preorder list of tree' elements such tour would be started by creating an instance of the subclass for given tree tand invoking its execute method this could be expressed as followstour preorderprintindentedtour(ttour execute