<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def Expand(self, rdf_artifact, requested):
 """Expand artifact by extending its sources. This method takes as input an rdf artifact object and returns a rdf expanded artifact. It iterates through the list of sources processing them by type. Each source of the original artifact can lead to one or more (in case of artifact groups and files where the sub artifacts are expanded recursively) sources in the expanded artifact. The list of sources of the expanded artifact is extended at the end of each iteration. The parameter `requested` is passed down at the recursive calls. So, if an artifact group is requested by the user, every artifact/source belonging to this group will be treated as requested by the user. The same applies to artifact files. Args: rdf_artifact: artifact object to expand (obtained from the registry) requested: Whether the artifact is requested by the user or scheduled for collection as a KnowledgeBase dependency. Yields: rdf value representation of expanded artifact containing the name of the artifact and the expanded sources """


    source_type = rdf_artifacts.ArtifactSource.SourceType

    expanded_artifact = rdf_artifacts.ExpandedArtifact(
        name=rdf_artifact.name,
        provides=rdf_artifact.provides,
        requested_by_user=requested)

    for source in rdf_artifact.sources:
      if MeetsConditions(self._knowledge_base, source):
        type_name = source.type

        if type_name == source_type.ARTIFACT_GROUP:
          for subartifact in self._ExpandArtifactGroupSource(source, requested):
            yield subartifact
          continue

        elif type_name == source_type.ARTIFACT_FILES:
          expanded_sources = self._ExpandArtifactFilesSource(source, requested)

        else:
          expanded_sources = self._ExpandBasicSource(source)

        expanded_artifact.sources.Extend(expanded_sources)
    self.processed_artifacts.add(rdf_artifact.name)
    if expanded_artifact.sources:
      yield expanded_artifact