code: def stop_server(self):
          
          if self.rpc_server is not None:
              try:
                  self.rpc_server.socket.shutdown(socket.SHUT_RDWR)
              except:
                  log.warning("Failed to shut down server socket")
  
              self.rpc_server.shutdown()
docs: Stop serving.  Also stops the thread.