Bonus points for coming up with python code that is callable as a module which can generate that. Have not looked at it yet, but next in queue is update_md.py included in yum. That might be all thats needed, but if someone wants to look see - please do so and confirm.
Confirmed -- I'm working to implement a small proof of concept + a tiny patch to update_md.py.