Chrome Remote Host: support py3 syntax

Tweak the code to work both with python2 and python3.

Few categories of changes:
 - use the print function everywhere
 - use 0o0 for octals
 - update the exception syntax style
 - change from dict.has_key to the "in" operator
 - fix invalid read/write modes
 - handle encoding when writing to stdin

BUG=537436
TEST=started & logged in & stopped daemon w/py2.7 in UTF8 locale
TEST=started & logged in & stopped daemon w/py2.7 in C locale
TEST=started & logged in & stopped daemon w/py3.4 in UTF8 locale
TEST=started & logged in & stopped daemon w/py3.4 in C locale

Review URL: https://codereview.chromium.org/1390823002

Cr-Commit-Position: refs/heads/master@{#352658}
1 file changed