'Encodes row data to the wire format.
Args:
rows: A list of pairs of a line number and a list of column values.
loader: Used for dependency injection.
Returns:
A list of datastore.Entity instances.
Raises:
ConfigurationError: if no loader is defined for self.kind'

def EncodeContent(self, rows, loader=None):

    if (not loader):
        try:
            loader = Loader.RegisteredLoader(self.kind)
        except KeyError:
            logger.error(('No    Loader    defined    for    kind    %s.' % self.kind))
            raise ConfigurationError(('No    Loader    defined    for    kind    %s.' % self.kind))
    entities = []
    for (line_number, values) in rows:
        key = loader.generate_key(line_number, values)
        if isinstance(key, datastore.Key):
            parent = key.parent()
            key = key.name()
        else:
            parent = None
        entity = loader.create_entity(values, key_name=key, parent=parent)
        def ToEntity(entity):
            if isinstance(entity, db.Model):
                return entity._populate_entity()
            else:
                return entity
        if (not entity):
            continue
        if isinstance(entity, list):
            entities.extend(map(ToEntity, entity))
        elif entity:
            entities.append(ToEntity(entity))
    return entities
