'Handle dict generation specifically for Artifacts.'

def ToPrimitiveDict(self):

    artifact_dict = super(Artifact, self).ToPrimitiveDict()
    artifact_dict['name'] = utils.SmartStr(self.name)
    for source in artifact_dict['sources']:
        if ('type' in source):
            source['type'] = str(source['type'])
        if ('key_value_pairs' in source['attributes']):
            outarray = []
            for indict in source['attributes']['key_value_pairs']:
                outarray.append(dict(indict.items()))
            source['attributes']['key_value_pairs'] = outarray
    for field in self.required_repeated_fields:
        if (field not in artifact_dict):
            artifact_dict[field] = []
    return artifact_dict
