ByteDance interview question

How to implement a hash-based aggregation in Python? (Extend to out of memory, extend to accelerators)