encode('utf8') doesn't seem be needed on python3, but is required on python2