List<String> (PyExpression value) { while (value instanceof PyParenthesizedExpression) { value = ((PyParenthesizedExpression)value).getContainedExpression(); } if (value instanceof PySequenceExpression) { final PyExpression[] elements = ((PySequenceExpression)value).getElements(); List<String> result = new ArrayList<>(elements.length); for (PyExpression element : elements) { if (!(element instanceof PyStringLiteralExpression)) { return null; } result.add(((PyStringLiteralExpression)element).getStringValue()); } return result; } return null; }