b = '1.3.4-1'
vc = apt_pkg.version_compare(a, b)
if vc > 0:
    print('version a > version b')
elif vc == 0:
    print('version a == version b')
elif vc < 0:
    pass
How to compare Debian package versions