def get_source(cell):
    """Gets the source code of a cell in a way that works for both nbformat and JSON
    
    Args:
        cell (``nbformat.NotebookNode``): notebook cell
    
    Returns:
        ``list`` of ``str``: each line of the cell source
    """
    source = cell['source']
    if isinstance(source, str):
        return cell['source'].split("\n")
    elif isinstance(source, list):
        return [l.strip() for l in source]
    assert False, f'unknown source type: {type(source)}'