def get_cells():
    'generator for sequence of code blocks to run'
    if (fname.suffix == '.ipynb'):
        from nbformat import read
        nb = read(fname, as_version=4)
        if (not nb.cells):
            return
        for cell in nb.cells:
            if (cell.cell_type == 'code'):
                (yield cell.source)
    else:
        (yield fname.read_text(encoding='utf-8'))
generator for sequence of code blocks to run
def get_cells():
    
    if (fname.suffix == '.ipynb'):
        from nbformat import read
        nb = read(fname, as_version=4)
        if (not nb.cells):
            return
        for cell in nb.cells:
            if (cell.cell_type == 'code'):
                (yield cell.source)
    else:
        (yield fname.read_text(encoding='utf-8'))