def cells_different(cell_a, cell_b, compare_outputs = True):
    """
    Return true/false if two cells are the same

    cell_a: (obj) JSON representation of first cell
    cell_b: (obj) JSON representation of second cell
    compare_outputs: (bool) whether to compare cell outputs, or just inputs
    """

    # check if cell type or source is different
    if (cell_a["cell_type"] != cell_b["cell_type"]
        or cell_a["source"] != cell_b["source"]):
        return True

    # otherwise compare outputs if it is a code cell
    elif compare_outputs and cell_b["cell_type"] == "code":
        # get the outputs
        cell_a_outs = cell_a['outputs']
        cell_b_outs = cell_b['outputs']
        # if different number of outputs, the cell has changed
        if len(cell_a_outs) != len(cell_b_outs):
            return True
        # compare the outputs one by one
        for j in range(len(cell_b_outs)):
            # check that the output type matches
            if cell_b_outs[j]['output_type'] != cell_a_outs[j]['output_type']:
                return True
            # and that the relevant data matches
            elif((cell_a_outs[j]['output_type'] in ["display_data","execute_result"]
                and cell_a_outs[j]['data'] != cell_b_outs[j]['data'])
                or (cell_a_outs[j]['output_type'] == "stream"
                and cell_a_outs[j]['text'] != cell_b_outs[j]['text'])
                or (cell_a_outs[j]['output_type'] == "error"
                and cell_a_outs[j]['evalue'] != cell_b_outs[j]['evalue'])):
                return True

    return False