input: Write a python function to list, add, delete, and update todo items.
  assert list_todos() == {'todos': []}
  add_todo = {"task": "Read a book"}
  assert add_todo == {'todo': {'task': 'Read a book'}}
  assert list_todos() == {'todos': [{'task': 'Read a book'}]}
  update_todo = {"task": "Read two books"}
  assert update_todo == {'todo': {'task': 'Read two books'}}
  assert list_todos() == {'todos': [{'task': 'Read two books'}]}
  assert delete_todo == {'result': True}
  assert list_todos() == {'todos': []}
output: todos = []
  
  def list_todos():
      return {'todos': todos}
  
  def add_todo(todo):
      todos.append(todo)
      return {'todo': todo}
  
  def update_todo(index, updated_todo):
      if 0 <= index < len(todos):
          todos[index] = updated_todo
          return {'todo': updated_todo}
      return {'error': 'Invalid index'}
  
  def delete_todo(index):
      if 0 <= index < len(todos):
          todos.pop(index)
          return {'result': True}
      return {'error': 'Invalid index'}