<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_to_datastore(self):
 """Writes all image batches to the datastore."""

    client = self._datastore_client
    with client.no_transact_batch() as client_batch:
      for batch_id, batch_data in iteritems(self._data):
        batch_key = client.key(self._entity_kind_batches, batch_id)
        batch_entity = client.entity(batch_key)
        for k, v in iteritems(batch_data):
          if k != 'images':
            batch_entity[k] = v
        client_batch.put(batch_entity)
        self._write_single_batch_images_internal(batch_id, client_batch)