'Returns the selected lines boundaries (start line, end line)
:return: tuple(int, int)'

def selection_range(self):

    editor = self._editor
    doc = editor.document()
    start = doc.findBlock(editor.textCursor().selectionStart()).blockNumber()
    end = doc.findBlock(editor.textCursor().selectionEnd()).blockNumber()
    text_cursor = QTextCursor(editor.textCursor())
    text_cursor.setPosition(editor.textCursor().selectionEnd())
    if ((text_cursor.columnNumber() == 0) and (start != end)):
        end -= 1
    return (start, end)
