code: def test_get_keras_attr(models, expected, get_keras_attr_kwargs):
      #################### Build Mock Nested Model ####################
      nested_model = None
      for model in models[::-1]:
          model = model()
          if nested_model:
              setattr(model, "model", nested_model)
          nested_model = model
  
      #################### Check Expected Attributes ####################
      for attr in list("abcdef"):
          if attr in expected:
              assert (
                  get_keras_attr(
                      nested_model, attr, **get_keras_attr_kwargs
                  )
                  == expected[attr]
              )
          else:
              with pytest.raises(AttributeError):
                  get_keras_attr(
                      nested_model, attr, **get_keras_attr_kwargs
                  )
  
imports: from hyperparameter_hunter.compat.keras_helper import get_concise_params_dict
  from hyperparameter_hunter.compat.keras_helper import get_keras_attr
  from hyperparameter_hunter.compat.keras_helper import keras_callback_to_key
  from hyperparameter_hunter.compat.keras_helper import keras_initializer_to_dict
  from hyperparameter_hunter.compat.keras_helper import parameterize_compiled_keras_model
  from hyperparameter_hunter.compat.keras_helper import parameters_by_signature
  from hyperparameter_hunter import Integer
  from pkg_resources import get_distribution
  import pytest
  from keras import initializers
  from keras import callbacks
  from keras.layers import Dense, Dropout, Embedding, Flatten, SpatialDropout1D
  from keras.losses import binary_crossentropy, mean_absolute_error
  from keras.models import Sequential
  from keras.optimizers import Adam, RMSprop
label_desc: Use image node_id 9 for calling a global function with example usage: test_get_keras_attr(models, expected, get_keras_attr_kwargs) without return types