code: def parameterize_compiled_keras_model(
      model,
  ) -> Tuple[List[dict], dict]:
      """Traverse a compiled Keras model to gather critical information about the layers used to
      construct its architecture, and the parameters used to compile it
  
      Parameters
      ----------
      model: Instance of :class:`keras.wrappers.scikit_learn.<KerasClassifier; KerasRegressor>`
          A compiled instance of a Keras model, made using the Keras `wrappers.scikit_learn` module.
          This must be a completely valid Keras model, which means that it often must be the result
          of :func:`compat.keras_optimization_helper.initialize_dummy_model`. Using the
          resulting dummy model ensures the model will pass Keras checks that would otherwise reject
          instances of `space.Space` descendants used to provide hyperparameter choices
  
      Returns
      -------
      layers: List[Dict]
          List containing a dict for each layer found in the architecture of `model`. A layer dict
          should contain the following keys: ['class_name', '__hh_default_args',
          '__hh_default_kwargs', '__hh_used_args', '__hh_used_kwargs']
      compile_params: Dict
          Parameters used on the call to :meth:`model.compile`. If a value for a certain parameter
          was not explicitly provided, its default value will be included in `compile_params`
      """
      # NOTE: `optimizer`/`loss` as callable or string is converted to callable automatically
      ##################################################
      # Model Compile Parameters
      ##################################################
      compile_params = dict()
  
      compile_params["optimizer"] = get_keras_attr(
          model, "optimizer"
      ).__class__.__name__.lower()
      compile_params["optimizer_params"] = get_keras_attr(
          model, "optimizer"
      ).get_config()
  
      compile_params["metrics"] = get_keras_attr(model, "metrics")
      compile_params["metrics_names"] = get_keras_attr(
          model, "metrics_names"
      )
  
      compile_params["loss_functions"] = get_keras_attr(
          model, "loss_functions"
      )
      compile_params["loss_function_names"] = [
          _.__name__ for _ in compile_params["loss_functions"]
      ]
  
      # FLAG: BELOW PARAMETERS SHOULD ONLY BE DISPLAYED IF EXPLICITLY GIVEN (probably have to be in key by default, though):
      compile_params["loss_weights"] = get_keras_attr(
          model, "loss_weights"
      )
      compile_params["sample_weight_mode"] = get_keras_attr(
          model, "sample_weight_mode"
      )
      compile_params["weighted_metrics"] = get_keras_attr(
          model, "weighted_metrics"
      )
  
      compile_params["target_tensors"] = get_keras_attr(
          model, "target_tensors", default=None
      )
      compile_params["compile_kwargs"] = get_keras_attr(
          model, "_function_kwargs"
      )
  
      ##################################################
      # Model Architecture
      ##################################################
      layers = []
  
      for layer in get_keras_attr(model, "layers"):
          layer_obj = dict(class_name=layer.__class__.__name__)
  
          for hh_attr in HH_ARG_ATTRS:
              layer_obj[hh_attr] = getattr(layer, hh_attr, None)
  
          layers.append(layer_obj)
  
      ##################################################
      # Check Custom Losses/Optimizers
      ##################################################
      if any(
          [
              _.__module__ != "keras.losses"
              for _ in compile_params["loss_functions"]
          ]
      ):
          G.warn(
              "Custom losses are not hashed/saved. They are identified only by their names."
              + "\nEnsure custom function names differ from those of Keras's native loss functions. "
              + "Otherwise, naming conflicts may make results very confusing (especially if tuning)."
          )
      if (
          get_keras_attr(model, "optimizer").__module__
          != "keras.optimizers"
      ):
          G.warn(
              "Custom optimizers are not hashed/saved. They are identified only by their names."
              + "\nEnsure custom optimizer names differ from those of Keras's native optimizers. "
              + "Otherwise, naming conflicts may make results very confusing (especially if tuning)."
          )
  
      return layers, compile_params
  
file_path: hyperparameter_hunter/hyperparameter_hunter/compat/keras_helper.py
imports: from hyperparameter_hunter.settings import G
  from hyperparameter_hunter.utils.general_utils import to_snake_case, subdict
  from inspect import signature, _empty
  from types import MethodType
  from typing import List, Tuple
label_desc: Use image node_id 8 for calling a global function with example usage: parameterize_compiled_keras_model(model) and returns: layers,  compile_params