code: def get_datasets_for_named_marks(
      vega_spec, magic_names, facet_mapping, scope=()
  ):
      datasets = {}
      group_index = 0
      mark_group = get_mark_group_for_scope(vega_spec, scope) or {}
      for mark in mark_group.get("marks", []):
          for magic_name in magic_names:
              if mark.get("name", "") == f"{magic_name}_cell":
                  data_name = (
                      mark.get("from", {})
                      .get("facet", None)
                      .get("data", None)
                  )
                  scoped_data_name = (data_name, scope)
                  datasets[magic_name] = get_from_facet_mapping(
                      scoped_data_name, facet_mapping
                  )
                  break
  
          name = mark.get("name", "")
          if mark.get("type", "") == "group":
              group_data_names = get_datasets_for_named_marks(
                  vega_spec,
                  magic_names,
                  facet_mapping,
                  scope=scope + (group_index,),
              )
              for k, v in group_data_names.items():
                  datasets.setdefault(k, v)
              group_index += 1
          else:
              for magic_name in magic_names:
                  if name.startswith(magic_name) and name.endswith(
                      "_marks"
                  ):
                      data_name = mark.get("from", {}).get("data", None)
                      scoped_data_name = get_scoped_data_reference(
                          vega_spec, data_name, scope
                      )
                      if scoped_data_name is not None:
                          datasets[magic_name] = get_from_facet_mapping(
                              scoped_data_name, facet_mapping
                          )
                          break
  
      return datasets
  
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 5 for calling a global function with example usage: get_datasets_for_named_marks(vega_spec, magic_names, facet_mapping, scope) and returns: datasets