Code to find subassembly for mate?

Is there an easy way to find what subassembly a mate belongsin? When I select a mate in the tree I would like to be able toopen the subassembly that the mate belongs to. The mate is afeature and when I get the features parents I'm not finding thesub. When I get the surfaces that the mate is fastened to and getthe components then the components are likely to be in a lowerassembly than the mate is.

I thought of grabbing the node and following that up the tree tofind the assembly but I'm not sure how to select just the nodewithout traversing the tree.

My next step is to get the names of the components and compare thecommon parts of the name to find the assembly but I was hopingthere is a code to do find the assembly.

Thanks
Dan Miel
SolidworksApi macros