def cursorAtSpaceEnd(block):
            cursor = QTextCursor(block)
            cursor.setPosition(block.position() + len(blockIndentation(block)))
            return cursor
def _nearest_weekday(weekday):
    return datetime.now() + timedelta(days=(weekday - datetime.now().weekday()) % 7)