[Maya API] Traversing the input graph of a node attribute

Hello guys,

i’m currently writing a few little plugins for Maya in order to teach myself the Maya API. So far its all python but as soon as i am more into the API
i’m gonna convert them to C++.
What i’m doing right now is a little command plugin that generates corrective shape meshes for use as front of chain blendshapes. (Like B-Lings old corrective shape script: http://www.b-ling.com/ )
Its all working so far, the only thing bugging me is that the command takes as arguments the bound geometry, the correctly sculpted geometry
and the skincluster node.

In an earlier attempt i was giving only the two transforms to the command and figured the skincluster by checking some connections by plugs.
That would work as long as the skincluster is the last deformer, but i soon taped into the situation where the deformation chain of a character had several deformers on top
of the skincluster, which broke the getSkincluster method.

Isn’t there any convenience method that traverses the deformation chain nodes or the input graph of a nodes attribute (and filters a certain node type)?
Or would you know a way to exactly relate a certain skincluster to its bound geometry, if its not directly connected by outmesh > inmesh?

Thanks ;D