If current level is more than or equal to maximum level seen so far for the same horizontal distance or horizontal distance is seen for the first time , update the dictionary
if hd in d : NEW_LINE INDENT if level >= d [ hd ] [ 1 ] : NEW_LINE INDENT d [ hd ] = [ root . data , level ] NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT d [ hd ] = [ root . data , level ] NEW_LINE DEDENT