REF: casting in _python_agg_general
Consolidate two for-loops into one.

Instead of using maybe_cast_result in two places, use it only once, immediately after the function call being wrapped.  Replace those two usages with the less-invasive `maybe_downcast_to_dtype`