If this is only used in one place, is there really a necessity to move it into a function? I understand that Java has its own function to convert to unicode but are there really performance benefits or is this just because Jython strings are vastly different from CPython/PyPy strings?