@gen.coroutine
def UpdateDevice(client, obj_store, user_id, device_id, request):
  """Updates the device metadata. Sets a new secure client access cookie.
  """
  device_dict = request['device_dict']
  if device_dict.has_key('device_id') and device_dict['device_id'] != device_id:
    raise web.HTTPError(400, 'bad auth cookie; device id mismatch %d != %d' %
                        (device_dict['device_id'], device_id))

  request['user_id'] = user_id
  request['device_id'] = device_id
  yield gen.Task(Operation.CreateAndExecute,
                 client,
                 user_id,
                 device_id,
                 'Device.UpdateOperation',
                 request)

  logging.info('UPDATE DEVICE: user: %d, device: %d' % (user_id, device_id))
  raise gen.Return({})
dataset/ETHPy150Open viewfinderco/viewfinder/backend/www/service.py/UpdateDevice/original