<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def WriteArtifactsFile(self, artifacts, filename):
 """Writes artifact definitions to a file. Args: artifacts (list[ArtifactDefinition]):
 artifact definitions to be written. filename (str):
 name of the file to write artifacts to. """

    with open(filename, 'w') as file_object:
      file_object.write(self.FormatArtifacts(artifacts))