def strip_transient(nb):
    """Strip transient values that shouldn't be stored in files.

    This should be called in *both* read and write.
    """
    nb.pop('orig_nbformat', None)
    nb.pop('orig_nbformat_minor', None)
    for ws in nb['worksheets']:
        for cell in ws['cells']:
            cell.get('metadata', {}).pop('trusted', None)
            cell.pop('trusted', None)
    return nb
