Takes in a filename of a notebook and returns a notebook object containing
    only the cell outputs to export.

def read_nb(filename, solution) -> nbformat.NotebookNode:
    """
    Takes in a filename of a notebook and returns a notebook object containing
    only the cell outputs to export.
    """
    with open(filename, 'r') as f:
        nb = nbformat.read(f, as_version=4)

    email = find_student_email(nb)
    preamble = nbformat.v4.new_markdown_cell(
        source='# ' + email, metadata={'tags': ['q_email']})

    tags_to_check = TAGS if not solution else SOL_TAGS
    cells = ([preamble] +
             [remove_input(cell) for cell in nb['cells']
              if cell_has_tags(cell, tags_to_check)])

    nb['cells'] = cells
    return nb