docs: def new_session(
          self,
          session_name=None,
          kill_session=False,
          attach=False,
          start_directory=None,
          window_name=None,
          window_command=None,
          *args,
          **kwargs
      ):
          """
          Return :class:`Session` from  ``$ tmux new-session``.
  
          Uses ``-P`` flag to print session info, ``-F`` for return formatting
          returns new Session object.
  
          ``$ tmux new-session -d`` will create the session in the background
          ``$ tmux new-session -Ad`` will move to the session name if it already
          exists. todo: make an option to handle this.
  
          Parameters
          ----------
          session_name : str, optional
              ::
  
                  $ tmux new-session -s <session_name>
          attach : bool, optional
              create session in the foreground. ``attach=False`` is equivalent
              to::
  
                  $ tmux new-session -d
  
          Other Parameters
          ----------------
          kill_session : bool, optional
              Kill current session if ``$ tmux has-session``.
              Useful for testing workspaces.
          start_directory : str, optional
              specifies the working directory in which the
              new session is created.
          window_name : str, optional
              ::
  
                  $ tmux new-session -n <window_name>
          window_command : str
              execute a command on starting the session.  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:`Session`
  
          Raises
          ------
          :exc:`exc.BadSessionName`
          """
          session_check_name(session_name)
  
          if self.has_session(session_name):
              if kill_session:
                  self.cmd('kill-session', '-t%s' % session_name)
                  logger.info('session %s exists. killed it.' % session_name)
              else:
                  raise exc.TmuxSessionExists('Session named %s exists' % session_name)
  
          logger.debug('creating session %s' % session_name)
  
          sformats = formats.SESSION_FORMATS
          tmux_formats = ['#{%s}' % f for f in sformats]
  
          env = os.environ.get('TMUX')
  
          if env:
              del os.environ['TMUX']
  
          tmux_args = (
              '-s%s' % session_name,
              '-P',
              '-F%s' % '\t'.join(tmux_formats),  # output
          )
  
          if not attach:
              tmux_args += ('-d',)
  
          if start_directory:
              tmux_args += ('-c', start_directory)
  
          if window_name:
              tmux_args += ('-n', window_name)
  
          # tmux 2.6 gives unattached sessions a tiny default area
          # no need send in -x/-y if they're in a client already, though
          if has_gte_version('2.6') and 'TMUX' not in os.environ:
              tmux_args += ('-x', 800, '-y', 600)
  
          if window_command:
              tmux_args += (window_command,)
  
          proc = self.cmd('new-session', *tmux_args)
  
          if proc.stderr:
              raise exc.LibTmuxException(proc.stderr)
  
          session = proc.stdout[0]
  
          if env:
              os.environ['TMUX'] = env
  
          # combine format keys with values returned from ``tmux list-windows``
          session = dict(zip(sformats, session.split('\t')))
  
          # clear up empty dict
          session = dict((k, v) for k, v in session.items() if v)
  
          session = Session(server=self, **session)
  
          return session