<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def save(self):
 """Update or insert a Todo item."""

    req = datastore.CommitRequest()
    req.mode = datastore.CommitRequest.NON_TRANSACTIONAL
    req.mutations.add().upsert.CopyFrom(self.to_proto())
    resp = datastore.commit(req)
    if not self.id:
      self.id = resp.mutation_results[0].key.path[-1].id
    return self