'Parse raw data collected for an artifact into the host_data table.'

def _AddToHostData(self, host_data, artifact, data, parser):

    if (type(data) != dict):
        raise test_lib.Error(('Data    for    %s    is    not    of    type    dictionary.' % artifact))
    rdfs = []
    stats = []
    files = []
    for (path, lines) in data.items():
        stat = self.CreateStat(path)
        stats.append(stat)
        file_obj = StringIO.StringIO(lines)
        files.append(file_obj)
        if (not parser.process_together):
            rdfs.extend(list(parser.Parse(stat, file_obj, None)))
    if parser.process_together:
        rdfs = list(parser.ParseMultiple(stats, files, None))
    host_data[artifact] = self.SetArtifactData(anomaly=[a for a in rdfs if isinstance(a, rdf_anomaly.Anomaly)], parsed=[r for r in rdfs if (not isinstance(r, rdf_anomaly.Anomaly))], raw=stats, results=host_data.get(artifact))
    return host_data
