sage: ZZ['a']['k'](g).coefficients()

By mixing var('a') and _.<k> you're creating an element that has a rather complicated representation. You're better off either sticking entirely with var('a,k') or with defining the appropriate polynomial ring explicitly.