code: def set_state(self, state, enable):
          
  
          is_enabled = self.get_state(state)
          if is_enabled == enable:
              return True
  
          key = None
          desired_states = [{'state': state, 'enabled': not is_enabled}]
  
          if state == States.FILTER_LOW_SPEED:
              if not self._multi_speed_pump:
                  return False
              # Send the FILTER key once.
              # If the pump is in high speed, it wil switch to low speed.
              # If the pump is off the retry mechanism will send an additional
              # FILTER key to switch into low speed.
              # If the pump is in low speed then we pretend the pump is off;
              # the retry mechanism will send an additional FILTER key
              # to switch into high speed.
              key = Keys.FILTER
              desired_states.append({'state': States.FILTER, 'enabled': True})
          else:
              # See if this state has a corresponding Key
              try:
                  key = Keys[state.name]
              except KeyError:
                  # TODO: send the appropriate combination of keys
                  # to enable the state
                  return False
  
          frame = self._get_key_event_frame(key)
  
          # Queue it to send immediately following the reception
          # of a keep-alive packet in an attempt to avoid bus collisions.
          self._send_queue.put({'frame': frame, 'desired_states': desired_states,
                                'retries': 10})
  
          return True
docs: Set the state.