Generate hash for .htaccess in Python

hash.py:

import getpass
import bcrypt

password = getpass.getpass("password: ")
hashed_pass = bcrypt.hashpw(password.encode("utf-8"), bcrypt.gensalt())

print(hashed_pass.decode())
Prerequisites installation on Debian:
sudo apt install python3-bcrypt
Sample execution:
$ python3 hash.py
password: 123
$2b$12$Hs4rQD2T.OeEq9uTiBzvWOiJ0b9Hi2w.ooKTefdbyWHFhPTVDLXO6