'Registers a new artifact.'

def RegisterArtifact(self, artifact_rdfvalue, source='datastore', overwrite_if_exists=False, overwrite_system_artifacts=False):

    artifact_name = artifact_rdfvalue.name
    if (artifact_name in self._artifacts):
        if (not overwrite_if_exists):
            raise ArtifactDefinitionError(('Artifact    named    %s    already    exists    and    overwrite_if_exists    is    set    to    False.' % artifact_name))
        elif (not overwrite_system_artifacts):
            artifact_obj = self._artifacts[artifact_name]
            if (not artifact_obj.loaded_from.startswith('datastore:')):
                raise ArtifactDefinitionError(('System    artifact    %s    cannot    be    overwritten.' % artifact_name))
    artifact_rdfvalue.loaded_from = source
    artifact_rdfvalue.error_message = None
    self._artifacts[artifact_rdfvalue.name] = artifact_rdfvalue
