That implementation looks pretty inefficient, creating lots of strings that are thrown away immediately. Could it not be refactored into a generator combined with a string.join?
It's specifically a CPython optimisation, it may (and usually will) not hold up on alternate implementations like pypy or jyton.
If PyPy or Jython want to reuse that core library code, it's on them to make whatever changes are needed to make it fast on those implementations.