def delete(self, entity):
    """Registers entity to delete from datastore.

    Args:
      entity: an entity, model instance, or key to delete.
    """
    # This is not very nice: we're calling two protected methods here...
    key = _normalize_key(entity)
    key_size = len(key._ToPb().Encode())
    if (self.deletes.length >= MAX_ENTITY_COUNT or
        (self.deletes.size + key_size) > self.max_pool_size):
      self.__flush_deletes()
    self.deletes.append(key, key_size)

  # TODO(user): some kind of error handling/retries is needed here.
dataset/ETHPy150Open livid/v2ex/mapreduce/context.py/MutationPool.delete/original