Notebook metadata, filtered for metadata added by Jupytext itself

def filtered_notebook_metadata(notebook):
    """Notebook metadata, filtered for metadata added by Jupytext itself"""
    metadata = copy(notebook.metadata)
    metadata = filter_metadata(metadata,
                               notebook.metadata.get('jupytext', {}).get('notebook_metadata_filter'),
                               _DEFAULT_NOTEBOOK_METADATA)
    if 'jupytext' in metadata:
        del metadata['jupytext']
    return metadata