changed the type checking in tornado.RequestHandler.write() reverting earlier  change