Use cast_bytes_py2
More descriptive error messages