code: def rename_window(self, new_name):
          
  
          import shlex
  
          lex = shlex.shlex(new_name)
          lex.escape = ' '
          lex.whitespace_split = False
  
          try:
              self.cmd('rename-window', new_name)
              self['window_name'] = new_name
          except Exception as e:
              logger.error(e)
  
          self.server._update_windows()
  
          return self
docs: Return :class:`Window` object ``$ tmux rename-window <new_name>``.
  
          Parameters
          ----------
          new_name : str
              name of the window