def encode_password(pw):
 enc = False
 if pw:
  encPW = __PW_PREFIX
  for c in pw:
   cnum = ord(c)
   if ((c == '#') or (cnum < 33) or (cnum > 126)):
    enc = True
   encPW += ('%2x' % cnum)
  if enc:
   return encPW
 return pw

def encode_password ( pw ) : enc = False if pw : encPW = __PW_PREFIX for c in pw : cnum = ord ( c ) if ( ( c == '#' ) or ( cnum < 33 ) or ( cnum > 126 ) ) : enc = True encPW += ( '%2x' % cnum ) if enc : return encPW return pw
returns a pbkdf2-hashed string .