code: def _sar(
      arch: str,
      pretrained: bool,
      backbone_fn,
      pretrained_backbone: bool = True,
      input_shape: Optional[Tuple[int, int, int]] = None,
      **kwargs: Any,
  ) -> SAR:
      pretrained_backbone = pretrained_backbone and not pretrained
  
      # Patch the config
      _cfg = deepcopy(default_cfgs[arch])
      _cfg["input_shape"] = input_shape or _cfg["input_shape"]
      _cfg["vocab"] = kwargs.get("vocab", _cfg["vocab"])
  
      # Feature extractor
      feat_extractor = backbone_fn(
          pretrained=pretrained_backbone,
          input_shape=_cfg["input_shape"],
          include_top=False,
      )
  
      kwargs["vocab"] = _cfg["vocab"]
  
      # Build the model
      model = SAR(feat_extractor, cfg=_cfg, **kwargs)
      # Load pretrained parameters
      if pretrained:
          load_pretrained_params(model, default_cfgs[arch]["url"])
  
      return model
  
imports: from copy import deepcopy
  from typing import Any, Dict, List, Optional, Tuple
  import tensorflow
  from tensorflow.keras import Model, Sequential, layers
  from doctr.datasets import VOCABS
  from doctr.utils.repr import NestedObject
  from ...classification import resnet31
  from ...utils.tensorflow import _bf16_to_float32, load_pretrained_params
  from ..core import RecognitionModel, RecognitionPostProcessor
label_desc: Use image node_id 1 for calling a global function with example usage: _sar(arch, pretrained, backbone_fn, pretrained_backbone, input_shape) and returns: model