REF: Move generic methods to aggregation.py
xref #29116

https://github.com/pandas-dev/pandas/pull/29116#pullrequestreview-340272465

based on @jreback comment, this PR is a precursor PR for #29116 to make PR smaller and more readable