code: def set_initial_state(self, kwargs):
          
  
          self.main_window = kwargs.pop("main_window")
  
          try:
              statustext = kwargs.pop("statustext")
  
          except KeyError:
              statustext = ""
  
          try:
              self.total_lines = kwargs.pop("total_lines")
              self.statustext = statustext + \
                  _("{nele} of {totalele} elements processed.")
  
          except KeyError:
              self.total_lines = None
              self.statustext = statustext + _("{nele} elements processed.")
  
          try:
              self.freq = kwargs.pop("freq")
  
          except KeyError:
              self.freq = 1000
  
          # The aborted attribute makes next() to raise StopIteration
          self.aborted = False
  
          # Line counter
          self.line = 0
  
          # Bindings
          self.main_window.Bind(wx.EVT_KEY_DOWN, self.on_key)
docs: Sets class state from kwargs attributes, pops extra kwargs