In this paper we describe how representation theory of groups can be used to shorten the derivation of two loop partition functions in string theory, giving an intrinsic description of modular forms appearing in the results of DHoker and Phong [1]. Our method has the advantage of using only algebraic properties of modular functions and it can be extended to any genus g.