code: def filtered_cell(cell, preserve_outputs, cell_metadata_filter):
      """Cell type, metadata and source from given cell"""
      filtered = {
          "cell_type": cell.cell_type,
          "source": cell.source,
          "metadata": filter_metadata(
              cell.metadata, cell_metadata_filter, _IGNORE_CELL_METADATA
          ),
      }
  
      if preserve_outputs:
          for key in ["execution_count", "outputs"]:
              if key in cell:
                  filtered[key] = cell[key]
  
      return filtered
  
imports: import difflib
  import json
  import os
  import re
  from jupytext.paired_paths import full_path
  from .cell_metadata import _IGNORE_CELL_METADATA
  from .combine import combine_inputs_with_outputs
  from .formats import check_auto_ext, long_form_one_format
  from .header import _DEFAULT_NOTEBOOK_METADATA
  from .jupytext import read, reads, write, writes
  from .metadata_filter import filter_metadata
label_desc: Use image node_id 3 for calling a global function with example usage: filtered_cell(cell, preserve_outputs, cell_metadata_filter) and returns: filtered