private static List<PyAstExpression> unfoldParentheses(PyAstExpression[] targets, List<PyAstExpression> receiver,
                                                         boolean unfoldListLiterals, boolean unfoldStarExpressions) {
    // NOTE: this proliferation of instanceofs is not very beautiful. Maybe rewrite using a visitor.
    for (PyAstExpression exp : targets) {
      if (exp instanceof PyAstParenthesizedExpression parenExpr) {
        unfoldParentheses(new PyAstExpression[]{parenExpr.getContainedExpression()}, receiver, unfoldListLiterals, unfoldStarExpressions);
      }
      else if (exp instanceof PyAstTupleExpression tupleExpr) {
        unfoldParentheses(tupleExpr.getElements(), receiver, unfoldListLiterals, unfoldStarExpressions);
      }
      else if (exp instanceof PyAstListLiteralExpression listLiteral && unfoldListLiterals) {
        unfoldParentheses(listLiteral.getElements(), receiver, true, unfoldStarExpressions);
      }
      else if (exp instanceof PyAstStarExpression && unfoldStarExpressions) {
        unfoldParentheses(new PyAstExpression[]{((PyAstStarExpression)exp).getExpression()}, receiver, unfoldListLiterals, true);
      }
      else if (exp != null) {
        receiver.add(exp);
      }
    }
    return receiver;
  }
private static List<PyAstExpression> unfoldParentheses(PyAstExpression[] targets, List<PyAstExpression> receiver,
                                                         boolean unfoldListLiterals, boolean unfoldStarExpressions)