Better binary values handling in python3