code: def extract_optimizers_from_path(
      opt_path, module_path, initializer=None
  ):
      optimizers = {}
  
      if not os.path.exists(opt_path):
          return optimizers
  
      if not module_path.endswith("."):
          module_path += "."
  
      for module in os.listdir(opt_path):
          if module == "__init__.py" or module[-3:] != ".py":
              continue
          try:
              lib = importlib.import_module(module_path + module[:-3])
              if "register_" + module[:-3] in lib.__dict__:
                  opt_init_func = lib.__dict__[
                      "register_" + module[:-3]
                  ]
                  if initializer is not None:
                      opt_init_func(initializer)
                  else:
                      opt_init_func()
              else:
                  for func in list(lib.__dict__.values()):
                      # if 'func' is a class
                      # and it inherits from OptimizerPass
                      # and is defined in this module (i.e., not imported)
                      if (
                          inspect.isclass(func)
                          and issubclass(func, OptimizerPass)
                          and func.__module__ == lib.__name__
                      ):
                          if inspect.ismethod(func.get_name):
                              optimizers[func.get_name()] = func
                          else:
                              func_instance = func()
                              optimizers[
                                  func_instance.get_name()
                              ] = func_instance
  
          except ImportError as e:
              print(
                  f"WARN: Unable to import optimizer(s) from {module}: {e}"
              )
              continue
  
      return optimizers
  
imports: import importlib
  import inspect
  import os
  from hls4ml.utils.string_utils import convert_to_snake_case
label_desc: Use image node_id 4 for calling a global function with example usage: extract_optimizers_from_path(opt_path, module_path, initializer) and returns: optimizers, optimizers