I wondering if you could use the stubs generator for this, like it is done for pulse and ffmpeg.

see: tools/generate_stubs/generate_stubs.py