fix python write binary with 'wb'