code: def save_optimizer_weights_to_hdf5_group(hdf5_group, optimizer):
      """Saves optimizer weights of a optimizer to a HDF5 group.
  
      Args:
          hdf5_group: HDF5 group.
          optimizer: optimizer instance.
      """
      if isinstance(optimizer, optimizers.Optimizer):
          symbolic_weights = optimizer.variables
      else:
          symbolic_weights = getattr(optimizer, "weights")
      if symbolic_weights:
          weights_group = hdf5_group.create_group("optimizer_weights")
          weight_names = [
              str(w.name).encode("utf8") for w in symbolic_weights
          ]
          save_attributes_to_hdf5_group(
              weights_group, "weight_names", weight_names
          )
          weight_values = [
              backend.convert_to_numpy(w) for w in symbolic_weights
          ]
          for name, val in zip(weight_names, weight_values):
              param_dset = weights_group.create_dataset(
                  name, val.shape, dtype=val.dtype
              )
              if not val.shape:
                  # scalar
                  param_dset[()] = val
              else:
                  param_dset[:] = val
  
imports: import json
  import os
  import warnings
  import numpy
  from absl import logging
  from keras import backend
  from keras import optimizers
  from keras.backend.common import global_state
  from keras.legacy.saving import json_utils
  from keras.legacy.saving import saving_options
  from keras.legacy.saving import saving_utils
  from keras.saving import object_registration
  from keras.utils import io_utils
label_desc: Use image node_id 5 for calling a global function with example usage: save_optimizer_weights_to_hdf5_group(hdf5_group, optimizer) without return types