code: def reinitialize_callbacks(callbacks):
      """Ensures the contents of `callbacks` are valid Keras callbacks
  
      Parameters
      ----------
      callbacks: List
          Expected to contain Keras callbacks, or dicts describing callbacks
  
      Returns
      -------
      callbacks: List
          A validated list of Keras callbacks"""
  
      if len(callbacks) > 0:
          for i in range(len(callbacks)):
              current_callback = callbacks[i]
  
              if not isinstance(current_callback, dict):
                  continue
  
              # Find `callback_initializer` by checking attributes of callback (`current_callback.values()`)
              # At the first attribute that is a method, fetch the class to which it is bound
              # This will be the class used to initialize the callback. Kinda sneaky
              callback_initializer = next(
                  _
                  for _ in current_callback.values()
                  if isinstance(_, MethodType)
              ).__self__.__class__
              callback_parameters = list(
                  signature(callback_initializer).parameters
              )
              callbacks[i] = callback_initializer(
                  **{
                      _: current_callback.get(_, None)
                      for _ in callback_parameters
                  }
              )
      return callbacks
  
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 3 for calling a global function with example usage: reinitialize_callbacks(callbacks) and returns: callbacks