find subtree of a tree using python

Job ID: 33516181

Budget: $10 – $30 CAD

What I need to have subtree of specific node based on a simple criterion to be returned.
For example, see the picture attached. we have A=12 and find the one with closer to A in such a way A-?<2 in inorder traversal (code attached). in the example, it is node =13 and then your code should return the subtree AND the its soot as well (see attached).

The code for creating a tree is attached. add a function named like subtree that can find subtree of arbitrary node based on a criterion such as subtree of node X which X-A<2 (A is passed to the function). The function returns a list of nodes in the subtree+the root of that subtree.

Python code is needed.
deadline 1 day.