code: def textForSaving(self):
          
          lines = self.text.splitlines()
          if self.text.endswith('\n'):  # splitlines ignores last \n
              lines.append('')
          return self.eol.join(lines) + self.eol
docs: Get text with correct EOL symbols. Use this method for saving a file to storage