code: def make_schema_replacement_function(
      system_schema: str, source_schema: str
  ) -> Callable[[str], str]:
      """Generates a function to replace schema names in test outputs."""
  
      # The schema of the warehouse used in tests changes from run to run, so don't compare those.
      def replacement_function(text: str) -> str:  # noqa: D
          # Replace with a string of the same length so that indents are preserved.
          text = text.replace(
              source_schema,
              PLACEHOLDER_CHAR_FOR_INCOMPARABLE_STRINGS
              * len(source_schema),
          )
          # Same with the MetricFlow system schema.
          return text.replace(
              system_schema,
              PLACEHOLDER_CHAR_FOR_INCOMPARABLE_STRINGS
              * len(system_schema),
          )
  
      return replacement_function
  
imports: from __future__ import annotations
  import difflib
  import logging
  import os
  import re
  import webbrowser
  from typing import Any, Callable, List, Optional, Tuple, TypeVar
  import tabulate
  from _pytest.fixtures import FixtureRequest
  from dbt_semantic_interfaces.pretty_print import pformat_big_objects
  from metricflow.dag.mf_dag import MetricFlowDag
  from metricflow.dataflow.dataflow_plan import DataflowPlan
  from metricflow.dataflow.dataflow_plan_to_text import dataflow_plan_as_text
  from metricflow.execution.execution_plan import ExecutionPlan
  from metricflow.execution.execution_plan_to_text import execution_plan_to_text
  from metricflow.mf_logging.pretty_print import mf_pformat
  from metricflow.model.semantics.linkable_spec_resolver import LinkableElementSet
  from metricflow.naming.object_builder_scheme import ObjectBuilderNamingScheme
  from metricflow.protocols.sql_client import SqlClient
  from metricflow.specs.specs import InstanceSpecSet, LinkableSpecSet
  from metricflow.test.fixtures.setup_fixtures import MetricFlowTestSessionState, check_sql_engine_snapshot_marker
label_desc: Use image node_id 1 for calling a global function with example usage: make_schema_replacement_function(system_schema, source_schema) and returns: replacement_function, text