@password.setter
def password(self, passwd):
    if isinstance(passwd, str):
        passwd = bytes(passwd, 'utf-8')
self.passwd = str(bcrypt.hashpw(passwd, bcrypt.gensalt()), 'utf8')
BCrypt. How to store salt with python3?