def set_password(self, service, username, password):
    'Write the password to the registry\n        '
    password_encrypted = _win_crypto.encrypt(password.encode('utf-8'))
    password_base64 = base64.encodestring(password_encrypted)
    password_saved = password_base64.decode('ascii')
    key_name = ('Software\\%s\\Keyring' % service)
    hkey = winreg.CreateKey(winreg.HKEY_CURRENT_USER, key_name)
    winreg.SetValueEx(hkey, username, 0, winreg.REG_SZ, password_saved)
Write the password to the registry
def set_password(self, service, username, password):
    '\n        '
    password_encrypted = _win_crypto.encrypt(password.encode('utf-8'))
    password_base64 = base64.encodestring(password_encrypted)
    password_saved = password_base64.decode('ascii')
    key_name = ('Software\\%s\\Keyring' % service)
    hkey = winreg.CreateKey(winreg.HKEY_CURRENT_USER, key_name)
    winreg.SetValueEx(hkey, username, 0, winreg.REG_SZ, password_saved)