def moderate_temperature(self, temperature):
        """
        Moderates the temperature of the cooker. Switches it off if the
        temperature is too high, and switches it off if it's too low, relative
        to the object's `target_temperature` property. Also writes out the on
        or off action and the temperature value.
        """

        if temperature < self.target_temperature:
            self.turn_cooker_on()
            self.write("%.2f on" % temperature)
        else:
            self.turn_cooker_off()
            self.write("%.2f off" % temperature)