So, thanks for your help Tim, there is a working beta version at github. Some improvements are still possible though, as noted in the readme.
I have a tracker for this. https://tracker.moodle.org/browse/CONTRIB-7081.
Suggestions for improvements always welcome.