code: def _maybe_insert_input_and_output_observers_for_node(
      node: Node,
      model: torch.fx.GraphModule,
      obs_or_fq_map: Dict[EdgeOrNode, ObserverOrFakeQuantize],
      is_qat: bool,
  ):
      this_node_quantization_annotation = (
          node.meta["quantization_annotation"]
          if "quantization_annotation" in node.meta
          else None
      )
      if this_node_quantization_annotation is None:
          return
  
      named_modules = dict(model.named_modules(remove_duplicate=False))
      _maybe_insert_input_observers_for_node(
          node,
          None,  # qconfig
          model,
          named_modules,
          obs_or_fq_map,
          is_qat,
      )
  
      output_is_a_tensor = "val" in node.meta and isinstance(
          node.meta["val"], FakeTensor
      )
      if not output_is_a_tensor:
          return
  
      # this returns the new observer node if it was needed
      maybe_output_obs_node = _maybe_insert_output_observer_for_node(
          node, model, named_modules, model.graph, obs_or_fq_map, is_qat
      )
  
      if maybe_output_obs_node is None:
          return
      # Update users of original node to use the output observer
      # instead. For example, change
      #
      #           next_node
      #          /
      #   cur_node -> obs
      #
      # to
      #
      #                 next_node
      #                 /
      #   cur_node -> obs
      #
      # We need to save orig users before updating uses because
      # the list of users will change as we update uses
      orig_users = list(node.users.keys())
      for user_node in orig_users:
          if user_node is maybe_output_obs_node:
              continue
          user_node.replace_input_with(node, maybe_output_obs_node)
  
imports: import torch
  from torch._subclasses import FakeTensor
  from torch.ao.quantization.fx.prepare import _insert_obs_or_fq, _save_state, _is_activation_post_process_node, _create_obs_or_fq_from_qspec
  from torch.fx import GraphModule, Graph, Node
  from torch.fx.node import Argument
  from torch.ao.quantization import QConfigMapping
  from torch.ao.quantization.qconfig import QConfigAny
  from torch.ao.quantization.fx.custom_config import PrepareCustomConfig
  from typing import Dict, Tuple, Union, Any, Optional
  from torch.ao.quantization.quantizer import EdgeOrNode, SharedQuantizationSpec, QuantizationSpecBase
  from torch.ao.quantization import ObserverOrFakeQuantize
label_desc: Use image node_id 14 for calling a global function with example usage: _maybe_insert_input_and_output_observers_for_node(node, model, obs_or_fq_map, is_qat) without return types