Bones 4 trees

Hi guys!
Is there any way to create bones from a given mesh of a tree trunk and branches?
It could work by somehow analyzing the diameter of the trunk and branches and then the script could decide where to put a bone (as much as possible aligned to the branches growth)
Basically... to create something like a "proxy" tree made of hierarchical bones from a given mesh.