Fix for problem with `valid_hostname` method in Python 3

It appears that splitting a string that has 'idna' encoding causes a crash in Python 3. I have added 1 line to create a string from the encoded hostname and then split that string. This fixes the crash on my system with Tornado 3.2.1 and Python 3.2.3.