code: def copy_filter_scopes(
      old_to_new_slc_id_dict: dict[int, int],
      old_filter_scopes: dict[int, dict[str, dict[str, Any]]],
  ) -> dict[str, dict[Any, Any]]:
      new_filter_scopes: dict[str, dict[Any, Any]] = {}
      for filter_id, scopes in old_filter_scopes.items():
          new_filter_key = old_to_new_slc_id_dict.get(int(filter_id))
          if new_filter_key:
              new_filter_scopes[str(new_filter_key)] = scopes
              for scope in scopes.values():
                  scope["immune"] = [
                      old_to_new_slc_id_dict[int(slice_id)]
                      for slice_id in scope.get("immune", [])
                      if int(slice_id) in old_to_new_slc_id_dict
                  ]
      return new_filter_scopes
  
file_path: superset/superset/utils/dashboard_filter_scopes_converter.py
imports: import json
  import logging
  from collections import defaultdict
  from typing import Any
  from shortid import ShortId
  from superset.models.slice import Slice
label_desc: Use image node_id 2 for calling a global function with example usage: copy_filter_scopes(old_to_new_slc_id_dict, old_filter_scopes) and returns: new_filter_scopes