REF: de-duplicate period-dispatch
@phofl you should be able to re-use with _accumulate to fix the PeriodDtype-with-Nat case
```
pandas/core/arrays/datetimelike.py:1554: error: Untyped decorator makes function "_quantile" untyped  [misc]
pandas/core/arrays/datetimelike.py:1562: error: Untyped decorator makes function "min" untyped  [misc]
pandas/core/arrays/datetimelike.py:1580: error: Untyped decorator makes function "max" untyped  [misc]
pandas/core/arrays/datetimelike.py:1635: error: Untyped decorator makes function "median" untyped  [misc]
``` Thanks @jbrockmendel 