<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _write(self, lines, fname):
 """ Writes a intermediate temporary sorted file :param lines: The lines to write. :param fname: The name of the temporary file. :return: """

        with open(fname, 'wb') as out_fhndl:
            for line in sorted(lines, key=self.key):
                pickle.dump(line, out_fhndl)