IElementType (@NotNull IElementType tokenType, @NotNull String tokenText, @NotNull LanguageLevel languageLevel, boolean unicodeImport) { final String prefix = PyStringLiteralCoreUtil.getPrefix(tokenText); if (tokenType == PyTokenTypes.SINGLE_QUOTED_STRING) { if (languageLevel.isPy3K()) { if (!PyStringLiteralUtil.isBytesPrefix(prefix)) return PyTokenTypes.SINGLE_QUOTED_UNICODE; } else if (unicodeImport && !PyStringLiteralUtil.isBytesPrefix(prefix) || PyStringLiteralUtil.isUnicodePrefix(prefix)) { return PyTokenTypes.SINGLE_QUOTED_UNICODE; } } if (tokenType == PyTokenTypes.TRIPLE_QUOTED_STRING) { if (languageLevel.isPy3K()) { if (!PyStringLiteralUtil.isBytesPrefix(prefix)) return PyTokenTypes.TRIPLE_QUOTED_UNICODE; } else if (unicodeImport && !PyStringLiteralUtil.isBytesPrefix(prefix) || PyStringLiteralUtil.isUnicodePrefix(prefix)) { return PyTokenTypes.TRIPLE_QUOTED_UNICODE; } } return tokenType; }