def dev_cache(self, device, key=None):
        """Get a cached value for a device."""
        device_cache = self._cache.get(CONST.DEVICES, {}).get(device.device_id)

        if device_cache and key:
            return device_cache.get(key)

        return device_cache
def dev_cache ( self , device , key = None ) : device_cache = self . _cache . get ( CONST . DEVICES , { } ) . get ( device . device_id ) if device_cache and key : return device_cache . get ( key ) return device_cache
Get a cached value for a device.