how to check if a vertex group is empty or not with python
Using list comprehension 

similar to that  used in this answer 

Because we are only interested in empty group will use python any to move on quickly when a non empty group is found. 

import bpy
ob = bpy.context.object
me = ob.data
for vg in ob.vertex_groups:
    mtvg = not any(vg.index in [g.group for g in v.groups] for v in me.vertices)
    print(vg.name, mtvg)


Then if vertex group vg is empty can remove with

ob.vertex_groups.remove(vg)