def comment_out_details(source):
    """
    Given the source of a cell, comment out  any lines that contain <details>
    """
    filtered=[]
    for line in source.splitlines():
        if "details>" in line:
            filtered.append('<!-- UNCOMMENT DETAILS AFTER RENDERING ' + line + ' END OF LINE TO UNCOMMENT -->')
        else:
            filtered.append(line)
    return '\n'.join(filtered)