code: def request_halt(self, req, msg):
          
          f = Future()
          @gen.coroutine
          def _halt():
              req.reply("ok")
              yield gen.moment
              self.stop(timeout=None)
              raise AsyncReply
  
          self.ioloop.add_callback(lambda: chain_future(_halt(), f))
          return f
docs: Halt the device server.
  
          Returns
          -------
          success : {'ok', 'fail'}
              Whether scheduling the halt succeeded.
  
          Examples
          --------
          ::
  
              ?halt
              !halt ok