<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def toggle(self):
 """ Toggle all the output devices. For each device, if it's on, turn it off; if it's off, turn it on. """

        for device in self:
            if isinstance(device, (OutputDevice, CompositeOutputDevice)):
                device.toggle()