def _ReadArtifactDefinition(self, yaml_definition):
    if not yaml_definition:
      raise errors.FormatError(u'Missing YAML definition.')

    different_keys = set(yaml_definition) - definitions.TOP_LEVEL_KEYS
    if different_keys:
      raise errors.FormatError(u'Undefined keys: {0}'.format(
          different_keys))

    name = yaml_definition.get(u'name', None)
    if not name:
      raise errors.FormatError(u'Invalid artifact definition missing name.')

    # The description is assumed to be mandatory.
    description = yaml_definition.get(u'doc', None)
    if not description:
      raise errors.FormatError(
          u'Invalid artifact definition: {0} missing description.'.format(
              name))

    artifact_definition = artifact.ArtifactDefinition(
        name, description=description)

    if yaml_definition.get(u'collectors', []):
      raise errors.FormatError(
          u'Invalid artifact definition: {0} still uses collectors.'.format(
              name))

    sources = yaml_definition.get(u'sources')
    if not sources:
      raise errors.FormatError(
          u'Invalid artifact definition: {0} missing sources.'.format(
              name))

    for source in sources:
      type_indicator = source.get(u'type', None)
      if not type_indicator:
        raise errors.FormatError(
            u'Invalid artifact definition: {0} source type.'.format(name))

      attributes = source.get(u'attributes', None)
      try:
        source_type = artifact_definition.AppendSource(
            type_indicator, attributes)
      except errors.FormatError as exception:
        raise errors.FormatError(
            u'Invalid artifact definition: {0}. {1}'.format(
                name, exception))

      # TODO: deprecate these left overs from the collector definition.
      if source_type:
        source_type.conditions = source.get(u'conditions', [])
        source_type.returned_types = source.get(u'returned_types', [])
        self._ReadSupportedOS(yaml_definition, source_type, name)

    # TODO: check conditions.
    artifact_definition.conditions = yaml_definition.get(u'conditions', [])
    artifact_definition.provides = yaml_definition.get(u'provides', [])
    self._ReadLabels(yaml_definition, artifact_definition, name)
    self._ReadSupportedOS(yaml_definition, artifact_definition, name)
    artifact_definition.urls = yaml_definition.get(u'urls', [])

    return artifact_definition
If key in odict, return value at key
dataset/ETHPy150Open ForensicArtifacts/artifacts/artifacts/reader.py/YamlArtifactsReader._ReadArtifactDefinition--crossover with--dataset/ETHPy150Open ioflo/ioflo/ioflo/aid/odicting.py/odict.setdefault