code: def trim_empty_columns(self):
      
      if self.nrows != 0 and self.ncols != 0:
        last_col = -1
        for row in self.rows:
          for i in range(last_col + 1, len(row)):
            if not self.is_cell_empty(row[i]):
              last_col = i
        ncols = last_col + 1
        self.rows = [row[:ncols] for row in self.rows]
        self.ncols = ncols
      return self
docs: Removes all trailing empty columns.