Affine Lie algebras, theta functions and modular forms