def generate_key(password, salt, iterations):
    assert iterations > 0
key = password + salt
for i in range(iterations):
    key = hashlib.sha256(key).digest()
return key
Encrypt / decrypt data in python with salt