code: def downgrade_filters(
      native_filters: Iterable[dict[str, Any]]
  ) -> int:
      """
      Move `defaultDataMask.filterState` into `defaultValue`
      """
      changed_filters = 0
      for native_filter in native_filters:
          default_data_mask = native_filter.pop("defaultDataMask", {})
          filter_state = default_data_mask.get("filterState")
          if filter_state is not None:
              changed_filters += 1
              value = filter_state.get("value")
              native_filter["defaultValue"] = value
      return changed_filters
  
file_path: superset/superset/migrations/versions/2021-04-29_15-32_f1410ed7ec95_migrate_native_filters_to_new_schema.py
imports: import json
  from collections.abc import Iterable
  from typing import Any
  from alembic import op
  from sqlalchemy import Column, Integer, Text
  from sqlalchemy.ext.declarative import declarative_base
  from superset import db
label_desc: Use image node_id 2 for calling a global function with example usage: downgrade_filters(native_filters) and returns: changed_filters