RDataFrame Aggregate within pyROOT

Technically I found at least one solution based on link, but I suspect this one is not the most elegant.

ROOT.EnableImplicitMT()
rdf = ROOT.ROOT.RDataFrame(10)
rdf = rdf.Define("x", "return rdfentry_;")
rdf = rdf.Define("x_sqr", "return rdfentry_*rdfentry_;")
#disp = rdf.Display("", 10)
#disp.Print()
ROOT.gInterpreter.Declare("""
struct Accumulator {
    ULong64_t operator()(ULong64_t acc, ULong64_t x) const { return acc + x; }
};
struct Combiner {
    ULong64_t operator()(ULong64_t acc1, ULong64_t acc2) const { return acc1 + acc2; }
};
""")
sum = rdf.Aggregate(ROOT.Accumulator(), ROOT.Combiner(), "x").GetValue()

Please let me know if you know a better way.