  A two dimensional gauge theory is canonically associated to every Drinfeld
double. For particular doubles, the theory turns out to be e.g. the ordinary
Yang-Mills theory, the G/G gauged WZNW model or the Poisson $\sigma$-model that
underlies the Kontsevich quantization formula. We calculate the arbitrary genus
partition function of the latter. The result is the $q$-deformation of the
ordinary Yang-Mills partition function in the sense that the series over the
weights is replaced by the same series over the $q$-weights. For $q$ equal to a
root of unity the series acquires the affine Weyl symmetry and its truncation
to the alcove coincides with the Verlinde formula.
