def _coercedUnicode(s):
 if isinstance(s, bytes):
  if _PY3:
   raise TypeError(('Expected str not %r (bytes)' % (s,)))
  else:
   return s.decode('ascii')
 else:
  return s

def _coercedUnicode ( s ) : if isinstance ( s , bytes ) : if _PY3 : raise TypeError ( ( 'Expected str not %r (bytes)' % ( s , ) ) ) else : return s . decode ( 'ascii' ) else : return s
coerce ascii-only byte strings into unicode for python 2 .