code: def set_mode(self, *modes, **kwargs):
          
          # Private mode codes are shifted, to be distingiushed from non
          # private ones.
          if kwargs.get("private"):
              modes = [mode << 5 for mode in modes]
              if mo.DECSCNM in modes:
                  self.dirty.update(range(self.lines))
  
          self.mode.update(modes)
  
          # When DECOLM mode is set, the screen is erased and the cursor
          # moves to the home position.
          if mo.DECCOLM in modes:
              self.saved_columns = self.columns
              self.resize(columns=132)
              self.erase_in_display(2)
              self.cursor_position()
  
          # According to VT520 manual, DECOM should also home the cursor.
          if mo.DECOM in modes:
              self.cursor_position()
  
          # Mark all displayed characters as reverse.
          if mo.DECSCNM in modes:
              for line in self.buffer.values():
                  line.default = self.default_char
                  for x in line:
                      line[x] = line[x]._replace(reverse=True)
  
              self.select_graphic_rendition(7)  # +reverse.
  
          # Make the cursor visible.
          if mo.DECTCEM in modes:
              self.cursor.hidden = False
docs: Set (enable) a given list of modes.
  
          :param list modes: modes to set, where each mode is a constant
                             from :mod:`pyte.modes`.