def pwConvert(pw, encode=True):
 if (pw == u''):
  return pw
 if encode:
  if Preferences.getUser(u'UseMasterPassword'):
   epw = pwEncrypt(pw)[0]
  else:
   epw = pwEncode(pw)
  return epw
 else:
  if Preferences.getUser(u'UseMasterPassword'):
   (plain, ok) = pwDecrypt(pw)
  else:
   (plain, ok) = (pwDecode(pw), True)
  return (plain if ok else pw)

def pwConvert ( pw , encode = True ) : if ( pw == u'' ) : return pw if encode : if Preferences . getUser ( u'UseMasterPassword' ) : epw = pwEncrypt ( pw ) [ 0 ] else : epw = pwEncode ( pw ) return epw else : if Preferences . getUser ( u'UseMasterPassword' ) : ( plain , ok ) = pwDecrypt ( pw ) else : ( plain , ok ) = ( pwDecode ( pw ) , True ) return ( plain if ok else pw )
module function to convert a plaintext password to the encoded form or vice versa .