code: def create_new_client(self, filename=None, give_focus=True):
          
          # Generate the notebook name (in case of a new one)
          if not filename:
              if not osp.isdir(NOTEBOOK_TMPDIR):
                  os.makedirs(NOTEBOOK_TMPDIR)
              nb_name = 'untitled' + str(self.untitled_num) + '.ipynb'
              filename = osp.join(NOTEBOOK_TMPDIR, nb_name)
              nb_contents = nbformat.v4.new_notebook()
              nbformat.write(nb_contents, filename)
              self.untitled_num += 1
  
          # Save spyder_pythonpath before creating a client
          # because it's needed by our kernel spec.
          if not self.testing:
              CONF.set('main', 'spyder_pythonpath',
                       self.main.get_spyder_pythonpath())
  
          # Open the notebook with nbopen and get the url we need to render
          try:
              server_info = nbopen(filename)
          except (subprocess.CalledProcessError, NBServerError):
              QMessageBox.critical(
                  self,
                  _("Server error"),
                  _("The Jupyter Notebook server failed to start or it is "
                    "taking too much time to do it. Please start it in a "
                    "system terminal with the command 'jupyter notebook' to "
                    "check for errors."))
              # Create a welcome widget
              # See issue 93
              self.untitled_num -= 1
              self.create_welcome_client()
              return
  
          welcome_client = self.create_welcome_client()
          client = NotebookClient(self, filename)
          self.add_tab(client)
          if NOTEBOOK_TMPDIR not in filename:
              self.add_to_recent(filename)
              self.setup_menu_actions()
          client.register(server_info)
          client.load_notebook()
          if welcome_client and not self.testing:
              self.tabwidget.setCurrentIndex(0)
docs: Create a new notebook or load a pre-existing one.