Python smart encoding (smart_unicode and other functions)