def generate_password_hash(password, rounds=None):
 if (rounds is None):
  rounds = settings.BCRYPT_LOG_ROUNDS
 if (not password):
  raise ValueError('Password must be non-empty.')
 pw_hash = bcrypt.hashpw(unicode(password).encode('utf-8'), bcrypt.gensalt(rounds))
 return pw_hash

def generate_password_hash ( password , rounds = None ) : if ( rounds is None ) : rounds = settings . BCRYPT_LOG_ROUNDS if ( not password ) : raise ValueError ( 'Password must be non-empty.' ) pw_hash = bcrypt . hashpw ( unicode ( password ) . encode ( 'utf-8' ) , bcrypt . gensalt ( rounds ) ) return pw_hash
generates a password hash using bcrypt .