Make stdout patching Python 2 compatible.

Otherwise ``print('str')`` would fail.
Fix AttributeError raised by setup_stdout when stdout does not have attribute encoding.

That might happen. See http://docs.python.org/glossary.html#term-file-object. An example might be the IORedirector used when running a program from Eclipse IDE.
Make UnicodeStream text-based.

Streams wrapped by the UnicodeStream are typically text (see docs.python.org/3/library/sys.html#sys.stdout).
Otherwise setup_stdout would return a UnicodeStream raising TypeError in case of stdout patched with StringIO.
remove: dnf.util.log_last_excpetion