code: def writeline(self, line, line_number):
          
          tmp_file = tempfile.TemporaryFile('w+')
          if not line.endswith(os.linesep):
  
              line += os.linesep
          try:
  
              with open(self.path, 'r') as file_handle:
  
                  for count, new_line in enumerate(file_handle):
  
                      if count == line_number:
  
                          new_line = line
  
                      tmp_file.write(new_line)
  
              tmp_file.seek(0)
              with open(self.path, 'w') as file_handle:
  
                  for new_line in tmp_file:
  
                      file_handle.write(new_line)
          finally:
  
              tmp_file.close()
docs: Rewrite a single line in the file.
  
          Args:
              line (str): The new text to write to the file.
              line_number (int): The line of the file to rewrite. Numbering
                  starts at 0.