I wrote a really quick'n'dirty one to be used as part as of a rig builder, so maybe you can use it as a starting point. Here's the code:
https://gist.github.com/christophercrouzet/2e74ca5b6f33500caf95b0c9244c27e6I've just extracted it from a codebase and didn't really tested it after that, so maybe there's some glitches. Also it relies on a library (that'd need a revamping) named `
banana.maya` but the functions being used could easily be extracted, I just didn't take the time to do so. Anyways, it should be enough as it is to give an idea of the basics.