Make _get_utf8_value Python3 compliant

This function now works with both Python 2 and 3.

Thanks to Victor Stinner for helping with this.

Change-Id: I1644db7705f7818471d06fb74a4b9a91956e6b58
Merge "Make _get_utf8_value Python3 compliant"