@gen.coroutine
def UpdatePhoto(client, obj_store, user_id, device_id, request):
  """Updates photo metadata."""
  request['user_id'] = user_id

  # If activity header is required, then expect it to have device_id from cookie.
  if request['headers']['original_version'] >= Message.ADD_OP_HEADER_VERSION:
    yield Activity.VerifyActivityId(client, user_id, device_id, request['activity']['activity_id'])
  else:
    yield Activity.VerifyActivityId(client, user_id, 0, request['activity']['activity_id'])

  request = {'headers': request.pop('headers'),
             'act_dict': request.pop('activity'),
             'ph_dict': request}

  yield gen.Task(Operation.CreateAndExecute,
                 client,
                 user_id,
                 device_id,
                 'Photo.UpdateOperation',
                 request)

  logging.info('UPDATE PHOTO: user: %d, device: %d, photo: %s' %
               (user_id, device_id, request['ph_dict']['photo_id']))
  raise gen.Return({})
dataset/ETHPy150Open viewfinderco/viewfinder/backend/www/service.py/UpdatePhoto/original