def METHOD_NAME(self, conn):
    for name, (klass, num_params) in self._aggregates.items():
        def make_aggregate():
            return (klass(), klass.step, klass.finalize)
        conn.createaggregatefunction(name, make_aggregate)