further compatibility with older versions of python-apt (#5853)

This is a fix for #5853

It should be merged only after #5854 and #5855 are merged.