docs: def new_window(
          self,
          window_name=None,
          start_directory=None,
          attach=True,
          window_index='',
          window_shell=None,
      ):
          """
          Return :class:`Window` from ``$ tmux new-window``.
  
          By default, this will make the window active. For the new window
          to be created and not set to current, pass in ``attach=False``.
  
          Parameters
          ----------
          window_name : str, optional
          start_directory : str, optional
              working directory in which the new window is created.
          attach : bool, optional
              make new window the current window after creating it, default True.
          window_index : str
              create the new window at the given index position. Default is empty
              string which will create the window in the next available position.
          window_shell : str
              execute a command on starting the window.  The window will close
              when the command exits.
  
              .. note::
                  When this command exits the window will close.  This feature is
                  useful for long-running processes where the closing of the
                  window upon completion is desired.
  
          Returns
          -------
          :class:`Window`
          """
          wformats = ['session_name', 'session_id'] + formats.WINDOW_FORMATS
          tmux_formats = ['#{%s}' % f for f in wformats]
  
          window_args = tuple()
  
          if not attach:
              window_args += ('-d',)
  
          window_args += ('-P',)
  
          if start_directory:
              # as of 2014-02-08 tmux 1.9-dev doesn't expand ~ in new-window -c.
              start_directory = os.path.expanduser(start_directory)
              window_args += ('-c%s' % start_directory,)
  
          window_args += ('-F"%s"' % '\t'.join(tmux_formats),)  # output
          if window_name:
              window_args += ('-n%s' % window_name,)
  
          window_args += (
              # empty string for window_index will use the first one available
              '-t%s:%s'
              % (self.id, window_index),
          )
  
          if window_shell:
              window_args += (window_shell,)
  
          proc = self.cmd('new-window', *window_args)
  
          if proc.stderr:
              raise exc.LibTmuxException(proc.stderr)
  
          window = proc.stdout[0]
  
          window = dict(zip(wformats, window.split('\t')))
  
          # clear up empty dict
          window = dict((k, v) for k, v in window.items() if v)
          window = Window(session=self, **window)
  
          self.server._update_windows()
  
          return window