cosmetic: reorder the imports in base.py and cli.py to match the Hacking guidelines[1]

It's not just that it looks better, it also makes it more straightforward to add
new imports.

[1] https://github.com/akozumpl/dnf/wiki/Hacking