code: def toggle_comments(self):
          
  
          if not self.__comment_marker:
              return True
  
          cursor = self.textCursor()
          if not cursor.hasSelection():
              cursor.movePosition(QTextCursor.StartOfBlock)
              line = foundations.strings.to_string(self.document().findBlockByNumber(cursor.blockNumber()).text())
              if line.startswith(self.__comment_marker):
                  foundations.common.repeat(cursor.deleteChar, len(self.__comment_marker))
              else:
                  cursor.insertText(self.__comment_marker)
          else:
              block = self.document().findBlock(cursor.selectionStart())
              while True:
                  block_cursor = self.textCursor()
                  block_cursor.setPosition(block.position())
                  if foundations.strings.to_string(block.text()).startswith(self.__comment_marker):
                      foundations.common.repeat(block_cursor.deleteChar, len(self.__comment_marker))
                  else:
                      block_cursor.insertText(self.__comment_marker)
  
                  if block.contains(cursor.selectionEnd()):
                      break
                  block = block.next()
          return True
docs: Toggles comments on the document selected lines.
  
          :return: Method success.
          :rtype: bool