<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_device_by_ain(self, ain):
 """Returns a device specified by the AIN."""

        devices = self.get_devices()
        for device in devices:
            if device.ain == ain:
                return device