encrypted_secret, algo, iterations, salt = db.get('some-user')
kdf = PBKDF2HMAC(algorithm=SHA256(), length=32, salt=str(salt), iterations=
    int(iterations), backend=default_backend())
key = base64.b64encode(kdf.derive(user_pwd))
f = Fernet(key)
secret = f.decrypt(encrypted_secret)
print('  Your secret is: %s' % secret)
Safely storing encrypted credentials in django