def device_update_or_create(self, context, values, create=None): if create is None: device = db.device_update_or_create(context, values) elif create is True: device = db.device_create(context, values) else: device = db.device_update(context,\ values['id'],\ values) return device