code: def shutdown_kernel(self):
          
          kernel_id = self.get_kernel_id()
  
          if kernel_id:
              delete_url = self.add_token(url_path_join(self.server_url,
                                                        'api/kernels/',
                                                        kernel_id))
              delete_req = requests.delete(delete_url)
              if delete_req.status_code != 204:
                  QMessageBox.warning(
                      self,
                      _("Server error"),
                      _("The Jupyter Notebook server "
                        "failed to shutdown the kernel "
                        "associated with this notebook. "
                        "If you want to shut it down, "
                        "you'll have to close Spyder."))
docs: Shutdown the kernel of the client.