Generator that removes from a list of strings the double dot
    reStructuredText comments and its contents based on indentation,
    removing trailing empty lines after each comment as well.

def commentless(data):
    """
    Generator that removes from a list of strings the double dot
    reStructuredText comments and its contents based on indentation,
    removing trailing empty lines after each comment as well.
    """
    it = iter(data)
    while True:
        line = next(it)
        while ":" in line or not line.lstrip().startswith(".."):
            yield line
            line = next(it)
        indent = indent_size(line)
        it = itertools.dropwhile(lambda el: indent_size(el) > indent
                                            or not el.strip(), it)