def u(s): '''Return unicode instance assuming UTF-8 encoded string. ''' if type(s) is unicode: return s else: return unicode(s, 'utf-8')