code: def update_slice_ids(pos: dict[Any, Any]) -> list[Slice]:
      """Update slice ids in position_json and return the slices found."""
      slice_components = [
          component
          for component in pos.values()
          if isinstance(component, dict)
          and component.get("type") == "CHART"
      ]
      slices = {}
      for name in {
          component["meta"]["sliceName"]
          for component in slice_components
      }:
          slc = (
              db.session.query(Slice).filter_by(slice_name=name).first()
          )
          if slc:
              slices[name] = slc
      for component in slice_components:
          slc = slices.get(component["meta"]["sliceName"])
          if slc:
              component["meta"]["chartId"] = slc.id
              component["meta"]["uuid"] = str(slc.uuid)
      return list(slices.values())
  
file_path: superset/superset/examples/helpers.py
imports: import json
  import os
  from typing import Any
  from superset import app, db
  from superset.connectors.sqla.models import SqlaTable
  from superset.models.slice import Slice
label_desc: Use image node_id 3 for calling a global function with example usage: update_slice_ids(pos) and returns: list