code: def clear(self):
          
          # Adapted from http://stackoverflow.com/a/13103617/1198772
          for i in reversed(list(range(self.extra_keywords_layout.count()))):
              self.extra_keywords_layout.itemAt(i).widget().setParent(None)
          self.widgets_dict = OrderedDict()
docs: Clear current state.