code: def toggle_class(self, csscl):
          
          self._stable = False
          action = ("add", "remove")[self.has_class(csscl)]
          return getattr(self.attrs["klass"], action)(csscl)
docs: Same as jQuery's toggleClass function. It toggles the css class on this element.