code: def metadata_filter_as_string(metadata_filter):
      """Convert a filter, represented as a dictionary with 'additional' and 'excluded' entries, to a string"""
      if not isinstance(metadata_filter, dict):
          return metadata_filter
  
      additional = metadata_filter.get("additional", [])
      if additional == "all":
          entries = ["all"]
      else:
          entries = [
              key
              for key in additional
              if key not in _JUPYTEXT_CELL_METADATA
          ]
  
      excluded = metadata_filter.get("excluded", [])
      if excluded == "all":
          entries.append("-all")
      else:
          entries.extend(["-" + e for e in excluded])
  
      return ",".join(entries)
  
file_path: jupytext/src/jupytext/metadata_filter.py
imports: from copy import copy
  from .cell_metadata import _JUPYTEXT_CELL_METADATA, is_valid_metadata_key
label_desc: Use image node_id 2 for calling a global function with example usage: metadata_filter_as_string(metadata_filter) and returns: str, metadata_filter