code: def call_fan(tstat):
      
      old_fan = tstat.fan
  
      tstat.write({
          'fan': not old_fan,
      })
  
      def restore():
          tstat.write({
              'fan': old_fan,
          })
      return restore
docs: Toggles the fan