I want encode block_string variable to keccak.
This is my current function. In this code I use sha256 (hashlib library) for encode block_string value but I want to use keccak instead of sha256:
def hash(block):
block_string = json.dumps(block, sort_keys=True).encode()
return hashlib.sha256(block_string).hexdigest()