def _clean_markdown_cells(ntbk):
    """Clean up cell text of an nbformat NotebookNode."""
    for cell in ntbk.cells:
        if cell.cell_type == 'markdown':
            cell_lines = cell.source.split('\n')
            for ii, line in enumerate(cell_lines):
                if line.startswith('#'):
                    cell_lines[ii] = line.rstrip('#').rstrip()
            cell.source = '\n'.join(cell_lines)
    return ntbk
