[4.0] remove UnicodeType and Python 2 related code
[4.0] remove UnicodeType and Python 2 related code

Also use tempfile.mkstemp instead of tempfile.mktemp which is
deprecated since Python 2.3

Change-Id: Ib32e2069f0ca914d2e104282186825488ac95a93

wikimedia/pywikibot-core,wikimedia/pywikibot-core