code: def _master(
      arch: str,
      pretrained: bool,
      backbone_fn,
      pretrained_backbone: bool = True,
      **kwargs: Any,
  ) -> MASTER:
      pretrained_backbone = pretrained_backbone and not pretrained
  
      # Patch the config
      _cfg = deepcopy(default_cfgs[arch])
      _cfg["input_shape"] = kwargs.get(
          "input_shape", _cfg["input_shape"]
      )
      _cfg["vocab"] = kwargs.get("vocab", _cfg["vocab"])
  
      kwargs["vocab"] = _cfg["vocab"]
      kwargs["input_shape"] = _cfg["input_shape"]
  
      # Build the model
      model = MASTER(
          backbone_fn(
              pretrained=pretrained_backbone,
              input_shape=_cfg["input_shape"],
              include_top=False,
          ),
          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, layers
  from doctr.datasets import VOCABS
  from doctr.models.classification import magc_resnet31
  from doctr.models.modules.transformer import Decoder, PositionalEncoding
  from ...utils.tensorflow import _bf16_to_float32, load_pretrained_params
  from .base import _MASTER, _MASTERPostProcessor
label_desc: Use image node_id 1 for calling a global function with example usage: _master(arch, pretrained, backbone_fn, pretrained_backbone) and returns: model