A Characterization of Affine Kac-Moody Lie Algebras