Exchange of Order of Summations over Finite Sets/Subset of Cartesian Product

Theorem
Let $\mathbb A$ be one of the standard number systems $\N, \Z, \Q, \R, \C$.

Let $S, T$ be finite sets.

Let $S \times T$ be their cartesian product. Let $D\subset S\times T$ be a subset.

Let $\pi_1 : D \to S$ and $\pi_2 : D \to T$ be the restrictions of the projections of $S\times T$.

Then we have an equality of summations over finite sets:
 * $\displaystyle \sum_{s \mathop \in S} \sum_{t \mathop \in \pi_1^{-1}(s)} f(s, t) = \sum_{t \mathop \in T} \sum_{s \mathop \in \pi_2^{-1}(t) } f(s, t)$

where $\pi_1^{-1}(s)$ denotes the inverse image of $s$ under $\pi_1$.