<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def save_device_info(self):
 """Save all device information to the device info file."""

        if self._workdir is not None:
            devices = []
            for addr in self._devices:
                device = self._devices.get(addr)
                if not device.address.is_x10:
                    aldb = {}
                    for mem in device.aldb:
                        rec = device.aldb[mem]
                        if rec:
                            aldbRec = {'memory': mem,
                                       'control_flags': rec.control_flags.byte,
                                       'group': rec.group,
                                       'address': rec.address.id,
                                       'data1': rec.data1,
                                       'data2': rec.data2,
                                       'data3': rec.data3}
                            aldb[mem] = aldbRec
                    deviceInfo = {'address': device.address.id,
                                  'cat': device.cat,
                                  'subcat': device.subcat,
                                  'product_key': device.product_key,
                                  'aldb_status': device.aldb.status.value,
                                  'aldb': aldb}
                    devices.append(deviceInfo)
            asyncio.ensure_future(self._write_saved_device_info(devices),
                                  loop=self._loop)