code: def _stopLeader(cls):
          
          with cls.lock:
              assert cls.initialized > 0
              cls.initialized -= 1
              if cls.initialized == 0:
                  if cls.loggingServer:
                      log.info('Stopping real-time logging server.')
                      cls.loggingServer.shutdown()
                      cls.loggingServer = None
                  if cls.serverThread:
                      log.info('Joining real-time logging server thread.')
                      cls.serverThread.join()
                      cls.serverThread = None
                  for k in list(os.environ.keys()):
                      if k.startswith(cls.envPrefix):
                          os.environ.pop(k)
docs: Stop the server on the leader.