code: def _group_by(table, aggregates, keys, use_threads=True):
      decl = Declaration.from_sequence(
          [
              Declaration(
                  "table_source", TableSourceNodeOptions(table)
              ),
              Declaration(
                  "aggregate",
                  AggregateNodeOptions(aggregates, keys=keys),
              ),
          ]
      )
      return decl.to_table(use_threads=use_threads)
  
imports: from pyarrow.lib import Table
  from pyarrow.compute import Expression, field
label_desc: Use image node_id 5 for calling a global function with example usage: _group_by(table, aggregates, keys, use_threads) and returns: decl