Dectree_max_depth

I am doing ML course. I see the function dectree_max_depth in the lesson 1-rf notebook.I am not clear on what this function does? Can anyone help me? I am not sure if Jeremy talked about this function in the video. I also searched for the same in course notes but did not find any reference to the same.

This function prints out the depth of a given tree. The code is pretty intuitive and uses dynamic programming to calculate this. I think the primary purpose of introducing this function is to demonstrate the inverse relationship between the depth of the tree and the min_samples_leaf.