code: def _default_root_node_getter(node_pattern):
      if node_pattern is None:
          return node_pattern
      while not isinstance(node_pattern, Node):
          node_pattern = node_pattern[-1]
      return node_pattern
  
imports: from abc import ABC
  from typing import Callable, Dict, List, Optional, Type
  import torch
  from torch.ao.quantization.backend_config import BackendConfig, DTypeConfig, ObservationType
  from torch.ao.quantization.utils import NodePattern, Pattern, QuantizerCls
  from torch.fx.graph import Node
  from .utils import all_node_args_have_no_tensors
label_desc: Use image node_id 1 for calling a global function with example usage: _default_root_node_getter(node_pattern) and returns: node_pattern, node_pattern