def AppendSource(self, type_indicator, attributes):
    if not type_indicator:
      raise errors.FormatError(u'Missing type indicator.')

    source_type_class = None
    if type_indicator == definitions.TYPE_INDICATOR_ARTIFACT_GROUP:
      source_type_class = source_type.ArtifactGroupSourceType

    elif type_indicator == definitions.TYPE_INDICATOR_COMMAND:
      source_type_class = source_type.CommandSourceType

    elif type_indicator == definitions.TYPE_INDICATOR_COMMAND:
      source_type_class = source_type.CommandCollectorDefinition

    elif type_indicator == definitions.TYPE_INDICATOR_DIRECTORY:
      source_type_class = source_type.DirectorySourceType

    elif type_indicator == definitions.TYPE_INDICATOR_FILE:
      source_type_class = source_type.FileSourceType

    elif type_indicator == definitions.TYPE_INDICATOR_PATH:
      source_type_class = source_type.PathSourceType

    elif type_indicator == definitions.TYPE_INDICATOR_WINDOWS_REGISTRY_KEY:
      source_type_class = source_type.WindowsRegistryKeySourceType

    elif type_indicator == definitions.TYPE_INDICATOR_WINDOWS_REGISTRY_VALUE:
      source_type_class = source_type.WindowsRegistryValueSourceType

    elif type_indicator == definitions.TYPE_INDICATOR_WMI_QUERY:
      source_type_class = source_type.WMIQuerySourceType

    else:
      raise errors.FormatError(
          u'Unsupported type indicator: {0}.'.format(type_indicator))

    try:
      source_object = source_type_class(**attributes)
    except (TypeError, AttributeError) as e:
      raise errors.FormatError(
          "Invalid artifact definition for {0}: {1}".format(self.name, e))

    self.sources.append(source_object)
    return source_object
Appends a source.
dataset/ETHPy150Open ForensicArtifacts/artifacts/artifacts/artifact.py/ArtifactDefinition.AppendSource