<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_file(self, path, mode="w"):
 """ Save the corpus to a text file in the original format. Arguments: path : str, where to save the corpus. mode : str, how to open the file. """

        with open(path, mode=mode) as f:
            for tree in self:
                for label, line in tree.to_labeled_lines():
                    f.write(line + "\n")