Commits the batch.

        This is called by :meth:`commit`.

def _commit(self):
        """Commits the batch.

        This is called by :meth:`commit`.
        """
        if self._id is None:
            mode = _datastore_pb2.CommitRequest.NON_TRANSACTIONAL
        else:
            mode = _datastore_pb2.CommitRequest.TRANSACTIONAL

        commit_response_pb = self._client._datastore_api.commit(
            self.project, mode, self._mutations, transaction=self._id
        )
        _, updated_keys = _parse_commit_response(commit_response_pb)
        # If the back-end returns without error, we are guaranteed that
        # ``commit`` will return keys that match (length and
        # order) directly ``_partial_key_entities``.
        for new_key_pb, entity in zip(updated_keys, self._partial_key_entities):
            new_id = new_key_pb.path[-1].id
            entity.key = entity.key.completed_key(new_id)