def write(self, data, mode='w'):
        """
        Write data to the file.

        `data` is the data to write
        `mode` is the mode argument to pass to `open()`
        """
        with open(self.path, mode) as f:
            f.write(data)
Write data to the file.

        `data` is the data to write
        `mode` is the mode argument to pass to `open()`