def get_device(self, id=None):
if id is None:<EOL><INDENT>if not self.devices:<EOL><INDENT>raise ValueError('<STR_LIT>' % self.hardware_id)<EOL><DEDENT>id, (device, version) = sorted(self.devices.items())[<NUM_LIT:0>]<EOL><DEDENT>elif id in self.devices:<EOL><INDENT>device, version = self.devices[id]<EOL><DEDENT>else:<EOL><INDENT>error = '<STR_LIT>' % id<EOL>log.error(error)<EOL>raise ValueError(error)<EOL><DEDENT>log.info("<STR_LIT>",<EOL>device, id, version)<EOL>return id, device, version<EOL>
Returns details of either the first or specified device

        :param int id: Identifier of desired device. If not given, first device
            found will be returned

        :returns tuple: Device ID, Device Address, Firmware Version