code: def OnSearchDirectionButton(self, event):
          
  
          if "DOWN" in self.search_options:
              flag_index = self.search_options.index("DOWN")
              self.search_options[flag_index] = "UP"
          elif "UP" in self.search_options:
              flag_index = self.search_options.index("UP")
              self.search_options[flag_index] = "DOWN"
          else:
              raise AttributeError(_("Neither UP nor DOWN in search_flags"))
  
          event.Skip()
docs: Event handler for search direction toggle button