def hash_ldap_user_password(user):
 try:
  password = user['password']
 except KeyError:
  return user
 else:
  return dict(user, password=ldap_hash_password(password))

def hash_ldap_user_password ( user ) : try : password = user [ 'password' ] except KeyError : return user else : return dict ( user , password = ldap_hash_password ( password ) )
hash a user dicts password without modifying the passed-in dict .