def compressCodeBlocks(self, text) :

        lines = text.split("\n")
        buffer = ""
        numLines = len(lines)
        for i in range(numLines) :
            
            if (lines[i].strip() or i == numLines-1  or i == 0 or
                not ( lines[i-1].startswith("    ")
                      and lines[i+1].startswith("    ") ) ):
                buffer += "\n" + lines[i]

        return buffer
Removes extra blank lines from code blocks.
dataset/ETHPy150Open lethain/lifeflow/markdown/odt2txt.py/OpenDocumentTextFile.compressCodeBlocks