# | | /-F # /--------| \--------| # | | \-I # | | # | \-E #---------| # | /-L # | /--------| # | | | /-N # | | \--------| # \--------| \-Q # | # | /-P # \--------| # \-S # Prune the tree in order to keep only some leaf nodes. t.prune(["H","F","E","Q", "P"]) print "Pruned tree" print t # # /-F # /--------| # /--------| \-H # | | #---------| \-E # | # | /-Q # \--------| # \-P # Let's re-create the same tree again