python: Fix python code for winreg, add test.