def control(nb, output):
    """
    Function to control the status of a given notebook
    :param nb: notebook name (.ipynb)
    :param output: Dict in which fields will be added
        .error : True or False
        .error in cell : nbr of the first cell where there was an error
    :return: None
    """
    cell_nr = 0
    output['error'] = False
    while cell_nr < len(nb.cells):
        if nb.cells[cell_nr].cell_type == 'code':
            if len(nb.cells[cell_nr].outputs) > 0:
                if nb.cells[cell_nr].outputs[0].output_type == 'error':
                    output['error'] = True
                    output['error in cell'] = cell_nr
                    output['error type'] = nb.cells[cell_nr].outputs[0]['ename'
                        ]
                    return output
        cell_nr += 1
    return
