docs: def set_state(self, new_state):
          """Assign the specified state to this consumer object.
  
          :param int new_state: The new state of the object
          :raises: ValueError
  
          """
          # Make sure it's a valid state
          if new_state not in self.STATES:
              raise ValueError('Invalid state value: %r' % new_state)
  
          # Set the state
          LOGGER.debug('State changing from %s to %s', self.STATES[self.state],
                       self.STATES[new_state])
          self.state = new_state
          self.state_start = time.time()