'Read attributes lazily'

def __getattr__(self, attr):

    try:
        code = DEVICE_ATTRIBUTES[attr]
    except KeyError:
        raise AttributeError(attr)
    value = c_int()
    driver.cuDeviceGetAttribute(byref(value), code, self.id)
    setattr(self, attr, value.value)
    return value.value
