code: def get_facet_mapping(vega_spec, scope=()):
      facet_mapping = {}
      group_index = 0
      mark_group = get_mark_group_for_scope(vega_spec, scope) or {}
      for mark in mark_group.get("marks", []):
          if mark.get("type", None) == "group":
              # Get facet for this group
              group_scope = scope + (group_index,)
              facet = mark.get("from", {}).get("facet", None)
              if facet is not None:
                  facet_name = facet.get("name", None)
                  facet_data = facet.get("data", None)
                  if facet_name is not None and facet_data is not None:
                      scoped_facet_data = get_scoped_data_reference(
                          vega_spec, facet_data, scope
                      )
                      if scoped_facet_data is not None:
                          facet_mapping[
                              (facet_name, group_scope)
                          ] = scoped_facet_data
  
              # Handle children recursively
              child_mapping = get_facet_mapping(
                  vega_spec, scope=group_scope
              )
              facet_mapping.update(child_mapping)
              group_index += 1
  
      return facet_mapping
  
file_path: vegafusion/python/vegafusion/vegafusion/evaluation.py
imports: from altair import data_transformers, Chart, FacetChart, LayerChart, HConcatChart, VConcatChart, ConcatChart
  from altair.utils.schemapi import Undefined
label_desc: Use image node_id 4 for calling a global function with example usage: get_facet_mapping(vega_spec, scope) and returns: facet_mapping