Replaced hex2bin with python version