<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ReadFromDirectory(self, artifacts_reader, path, extension='yaml'):
 """Reads artifact definitions into the registry from files in a directory. This function does not recurse sub directories. Args: artifacts_reader (ArtifactsReader):
 an artifacts reader. path (str):
 path of the directory to read from. extension (Optional[str]):
 extension of the filenames to read. Raises: KeyError: if a duplicate artifact definition is encountered. """

    for artifact_definition in artifacts_reader.ReadDirectory(
        path, extension=extension):
      self.RegisterDefinition(artifact_definition)