code: def rpc_stop(server_state):
      
      rpc_srv = server_state['rpc']
  
      if rpc_srv is not None:
          log.info("Shutting down RPC")
          rpc_srv.stop_server()
          rpc_srv.join()
          log.info("RPC joined")
  
      else:
          log.info("RPC already joined")
  
      server_state['rpc'] = None
docs: Stop the global RPC server thread