code: def register_optimizer(
      name: str, optimizer: Optimizer, optimizer_params: OptimizerParams
  ):
      """
      Checks if the optimizer name exists in the registry, and if it doesnt, adds it.
  
      This allows custom optimizers to be added and called by name during instantiation.
  
      Args:
          name: Name of the optimizer. Will be used as key to retrieve the optimizer.
          optimizer: Optimizer class
          optimizer_params: The parameters as a dataclass of the optimizer
      """
      if name in AVAILABLE_OPTIMIZERS:
          raise ValueError(
              f"Cannot override pre-existing optimizers. Conflicting optimizer name = {name}"
          )
  
      AVAILABLE_OPTIMIZERS[name] = optimizer
  
      optim_name = "{}_params".format(optimizer.__name__)
      register_optimizer_params(
          name=optim_name, optimizer_params=optimizer_params
      )
  
file_path: NeMo/nemo/core/optim/optimizers.py
imports: import copy
  from functools import partial
  from typing import Any, Dict, Optional, Union
  import hydra
  import torch
  import torch.optim
  from omegaconf import DictConfig, OmegaConf
  from torch.optim import adadelta, adagrad, adamax, rmsprop, rprop
  from torch.optim.optimizer import Optimizer
  from nemo.core.config import OptimizerParams, get_optimizer_config, register_optimizer_params
  from nemo.core.optim.adafactor import Adafactor
  from nemo.core.optim.adan import Adan
  from nemo.core.optim.novograd import Novograd
  from nemo.utils import logging
  from nemo.utils.model_utils import maybe_update_config_version
label_desc: Use image node_id 2 for calling a global function with example usage: register_optimizer(name, optimizer, optimizer_params) without return types