<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def move_lines(self, direction=QTextCursor.Up):
 """ Moves the document lines under cursor. :param direction: Move direction ( QTextCursor.Down / QTextCursor.Up ). ( QTextCursor.MoveOperation ) :return: Method success. :rtype: bool """


        cursor = self.textCursor()
        if (direction == QTextCursor.Up and cursor.block() == cursor.document().firstBlock()) or \
                (direction == QTextCursor.Down and cursor.block() == cursor.document().lastBlock()):
            return False

        self.__select_text_under_cursor_blocks(cursor)
        text = cursor.selectedText()
        cursor.removeSelectedText()
        cursor.deleteChar()

        cursor.setPosition(cursor.block().next().position() if direction == QTextCursor.Down else
                           cursor.block().previous().position())
        if cursor.position() == cursor.document().firstBlock().position() and direction == QTextCursor.Down:
            cursor.movePosition(QTextCursor.End)
            cursor.insertText(QChar(QChar.ParagraphSeparator))

        start_position = cursor.position()
        cursor.insertText(text)
        end_position = cursor.position()
        not cursor.atEnd() and cursor.insertText(QChar(QChar.ParagraphSeparator))

        cursor.setPosition(start_position, QTextCursor.MoveAnchor)
        cursor.setPosition(end_position, QTextCursor.KeepAnchor)
        self.setTextCursor(cursor)

        return True