code: def _run_prepare_fx_on_standalone_modules(
      model: torch.nn.Module,
      is_qat: bool,
      named_modules: Dict[str, torch.nn.Module],
      node_name_to_match_result_with_qconfig: Any,
      prepare_custom_config: PrepareCustomConfig,
      backend_config: BackendConfig,
  ) -> None:
      """
      Runs prepare_fx on each standalone module. Note: this does
      not modify the graph, it just replaces the unobserved modules with
      their observed versions.
      """
      for (
          root_node,
          _,
          pattern,
          qhandler,
          qconfig,
      ) in node_name_to_match_result_with_qconfig.values():
          if qhandler is None:
              continue
          elif not qhandler.is_standalone_module():
              continue
  
          (
              sm_qconfig_mapping,
              sm_example_inputs,
              sm_prepare_custom_config,
              sm_backend_config,
          ) = _get_standalone_module_configs(
              root_node,
              named_modules,
              prepare_custom_config,
              qconfig,
              backend_config,
          )
  
          standalone_module = named_modules[root_node.target]
          prepare = (
              torch.ao.quantization.quantize_fx._prepare_standalone_module_fx
          )  # type: ignore[attr-defined]
          observed_standalone_module = prepare(
              standalone_module,
              sm_qconfig_mapping,
              is_qat,
              example_inputs=sm_example_inputs,
              prepare_custom_config=sm_prepare_custom_config,
              backend_config=sm_backend_config,
          )
          parent_name, name = _parent_name(root_node.target)
          setattr(
              named_modules[parent_name],
              name,
              observed_standalone_module,
          )
          named_modules[root_node.target] = observed_standalone_module
  
imports: import copy
  import torch
  import warnings
  from torch.fx import GraphModule
  from torch.fx.graph import Graph, Node
  from torch.fx.node import Argument
  from ..quantize import propagate_qconfig_
  from ..observer import _is_activation_post_process, _PartialWrapper
  from ..qconfig import _is_reuse_input_qconfig, QConfigAny
  from ..qconfig_mapping import QConfigMapping
  from .qconfig_mapping_utils import _generate_node_name_to_qconfig, _update_qconfig_for_fusion, _get_flattened_qconfig_dict, _update_qconfig_for_qat
  from .quantize_handler import _default_root_node_getter, _get_pattern_to_quantize_handlers, QuantizeHandler
  from torch.ao.quantization import ObserverBase, FixedQParamsObserver, FixedQParamsFakeQuantize, _DerivedObserverOrFakeQuantize
  from torch.ao.quantization.utils import Pattern, NodePattern
  from ._equalize import is_equalization_observer, node_supports_equalization
  from .pattern_utils import _sorted_patterns_dict
  from .match_utils import _MatchResultWithQConfig, _find_matches
  from .utils import _insert_dequant_stubs_for_custom_module_lstm_output, _is_custom_module_lstm, _maybe_get_custom_module_lstm_from_node_arg, _qconfig_satisfies_dtype_config_constraints, get_custom_module_class_keys, all_node_args_have_no_tensors, assert_and_get_unique_device, get_non_observable_arg_indexes_and_types, get_new_attr_name_with_prefix, node_arg_is_weight, node_arg_is_bias, NON_QUANTIZABLE_WEIGHT_OPS, ObservedGraphModuleAttrs
  from torch.ao.quantization import PlaceholderObserver
  from torch.ao.quantization.quantize import convert
  from ..utils import _parent_name, get_qconfig_dtypes, get_swapped_custom_module_class
  from ..backend_config.utils import get_pattern_to_dtype_configs, get_module_to_qat_module, get_fusion_pattern_to_root_node_getter
  from ..backend_config import BackendConfig, DTypeConfig, get_native_backend_config
  from .custom_config import PrepareCustomConfig, StandaloneModuleConfigEntry
  from torch.ao.quantization.quantizer import EdgeOrNode, QuantizationSpec, QuantizationSpecBase, FixedQParamsQuantizationSpec, SharedQuantizationSpec, DerivedQuantizationSpec
  from torch.ao.quantization import ObserverOrFakeQuantize
  from torch._subclasses import FakeTensor
  from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union
  from dataclasses import asdict
label_desc: Use image node_id 31 for calling a global function with example usage: _run_prepare_fx_on_standalone_modules(model, is_qat, named_modules, node_name_to_match_result_with_qconfig, prepare_custom_config, backend_config) without return types