code: def resnet(
      num_blocks: int,
      classes: int = 10,
      input_shape: Tuple[int, int, int] = (32, 32, 3),
  ) -> tf.keras.Model:
      """
      Define ResNet.
  
      Parameters
      ----------
      num_blocks
          Number of ResNet blocks.
      classes
          Number of classification classes.
      input_shape
          Input shape of an image.
  
      Returns
      -------
      ResNet as a tf.keras.Model.
      """
      bn_axis = 3  # channels last format
      l2_regularisation = True
  
      x_in = Input(shape=input_shape)
      x = ZeroPadding2D(padding=(1, 1), name="conv1_pad")(x_in)
      x = Conv2D(
          16,
          (3, 3),
          strides=(1, 1),
          padding="valid",
          use_bias=False,
          kernel_initializer="he_normal",
          kernel_regularizer=l2_regulariser(l2_regularisation),
          name="conv1",
      )(x)
      x = BatchNormalization(
          axis=bn_axis,
          momentum=BATCH_NORM_DECAY,
          epsilon=BATCH_NORM_EPSILON,
          name="bn_conv1",
      )(x)
      x = Activation("relu")(x)
  
      x = resnet_block(
          x_in=x,
          size=num_blocks,
          filters=(16, 16),
          kernel_size=3,
          stage=2,
          strides=(1, 1),
          l2_regularisation=True,
      )
  
      x = resnet_block(
          x_in=x,
          size=num_blocks,
          filters=(32, 32),
          kernel_size=3,
          stage=3,
          strides=(2, 2),
          l2_regularisation=True,
      )
  
      x = resnet_block(
          x_in=x,
          size=num_blocks,
          filters=(64, 64),
          kernel_size=3,
          stage=4,
          strides=(2, 2),
          l2_regularisation=True,
      )
  
      x = tf.reduce_mean(
          x, axis=(1, 2)
      )  # take mean across width and height
      x_out = Dense(
          classes,
          activation="softmax",
          kernel_initializer=RandomNormal(stddev=0.01),
          kernel_regularizer=l2(L2_WEIGHT_DECAY),
          bias_regularizer=l2(L2_WEIGHT_DECAY),
          name="fc10",
      )(x)
  
      model = Model(x_in, x_out, name="resnet")
      return model
  
imports: import argparse
  import numpy
  import os
  from pathlib import Path
  import tensorflow
  from tensorflow.keras.callbacks import Callback, ModelCheckpoint
  from tensorflow.keras.initializers import RandomNormal
  from tensorflow.keras.layers import Activation, Add, BatchNormalization, Conv2D, Dense, Input, ZeroPadding2D
  from tensorflow.keras.models import Model
  from tensorflow.keras.optimizers import SGD
  from tensorflow.keras.preprocessing.image import ImageDataGenerator
  from tensorflow.keras.regularizers import l2
  from typing import Callable, Tuple, Union
label_desc: Use image node_id 5 for calling a global function with example usage: resnet(num_blocks, classes, input_shape) and returns: model