code: def make_sub_nested_model(input_shape):
      """
      The following abomination will create this hierarchy:
      Sequential
          Dense (first_dense)
          Functional (fun_model)
              Dense (fun_first_dense)
              Sequential (fun_model_seq_sub)
                  Dense
                  Dense
              Dense (fun_middle_dense)
              Functional (fun_model_fun_sub)
                  Dense
                  Dense
              Dense (fun_last_dense)
          Dense (middle_dense)
          Sequential (seq_model)
              Dense
              Functional (seq_model_fun_sub)
                  Dense
                  Dense
              Dense
              Sequential (seq_model_seq_sub)
                  Dense
                  Dense
              Dense
          Dense (last_dense)
      """
      fun_model_seq_sub = Sequential(name="fun_model_seq_sub")
      fun_model_seq_sub.add(
          Dense(
              5,
              activation="linear",
              input_shape=(5,),
              name="fun_seq_sub_dense_1",
          )
      )
      fun_model_seq_sub.add(
          Dense(3, activation="linear", name="fun_seq_sub_dense_2")
      )
  
      fun_fun_input = Input(shape=(8,), name="fun_fun_input")
      fun_fun_x = Dense(
          7, activation="linear", name="fun_fun_sub_dense_1"
      )(fun_fun_input)
      fun_fun_x = Dense(
          6, activation="linear", name="fun_fun_sub_dense_2"
      )(fun_fun_x)
      fun_model_fun_sub = Model(
          inputs=fun_fun_input,
          outputs=fun_fun_x,
          name="fun_model_fun_sub",
      )
  
      fun_input = Input(shape=(10,), name="fun_input")
      fun_x = Dense(5, activation="linear", name="fun_first_dense")(
          fun_input
      )
      fun_x = fun_model_seq_sub(fun_x)
      fun_x = Dense(8, activation="linear", name="fun_middle_dense")(
          fun_x
      )
      fun_x = fun_model_fun_sub(fun_x)
      fun_x = Dense(4, activation="linear", name="fun_last_dense")(
          fun_x
      )
      fun_model = Model(
          inputs=fun_input, outputs=fun_x, name="fun_model"
      )
  
      seq_fun_input = Input(shape=(2,), name="seq_fun_input")
      seq_fun_x = Dense(
          9, activation="linear", name="seq_fun_sub_dense_1"
      )(seq_fun_input)
      seq_fun_x = Dense(
          3, activation="linear", name="seq_fun_sub_dense_2"
      )(seq_fun_x)
      seq_model_fun_sub = Model(
          inputs=seq_fun_input,
          outputs=seq_fun_x,
          name="seq_model_fun_sub",
      )
  
      seq_model_seq_sub = Sequential(name="seq_model_seq_sub")
      seq_model_seq_sub.add(
          Dense(
              5,
              activation="linear",
              input_shape=(2,),
              name="seq_seq_sub_dense_1",
          )
      )
      seq_model_seq_sub.add(
          Dense(7, activation="linear", name="seq_seq_sub_dense_2")
      )
  
      seq_model = Sequential(name="seq_model")
      seq_model.add(
          Dense(
              2,
              activation="linear",
              input_shape=(6,),
              name="seq_first_dense",
          )
      )
      seq_model.add(seq_model_fun_sub)
      seq_model.add(
          Dense(2, activation="linear", name="seq_middle_dense")
      )
      seq_model.add(seq_model_seq_sub)
      seq_model.add(
          Dense(2, activation="linear", name="seq_last_dense")
      )
  
      model = Sequential()
      model.add(
          Dense(
              10,
              activation="linear",
              input_shape=input_shape,
              name="first_dense",
          )
      )
      model.add(fun_model)
      model.add(Dense(6, activation="linear", name="middle_dense"))
      model.add(seq_model)
      model.add(Dense(4, activation="linear", name="last_dense"))
  
      return model
  
file_path: hls4ml/test/pytest/test_keras_nested_model.py
imports: from pathlib import Path
  import numpy
  import pytest
  from tensorflow.keras.layers import Dense, Input
  from tensorflow.keras.models import Model, Sequential
  import hls4ml
label_desc: Use image node_id 2 for calling a global function with example usage: make_sub_nested_model(input_shape) and returns: model