code: def make_optimizer(optimizer_type, module=None, **kwargs):
      """Create an optimizer for pyTorch & tensorflow algos.
  
      Args:
          optimizer_type (Union[type, tuple[type, dict]]): Type of optimizer.
              This can be an optimizer type such as 'torch.optim.Adam' or a
              tuple of type and dictionary, where dictionary contains arguments
              to initialize the optimizer e.g. (torch.optim.Adam, {'lr' : 1e-3})
          module (optional): If the optimizer type is a `torch.optimizer`.
              The `torch.nn.Module` module whose parameters needs to be optimized
              must be specify.
          kwargs (dict): Other keyword arguments to initialize optimizer. This
              is not used when `optimizer_type` is tuple.
  
      Returns:
          torch.optim.Optimizer: Constructed optimizer.
  
      Raises:
          ValueError: Raises value error when `optimizer_type` is tuple, and
              non-default argument is passed in `kwargs`.
  
      """
      if isinstance(optimizer_type, tuple):
          opt_type, opt_args = optimizer_type
          for name, arg in kwargs.items():
              if not isinstance(arg, _Default):
                  raise ValueError(
                      "Should not specify {} and explicit \
                      optimizer args at the same time".format(
                          name
                      )
                  )
          if module is not None:
              return opt_type(module.parameters(), **opt_args)
          else:
              return opt_type(**opt_args)
  
      opt_args = {
          k: v.val if isinstance(v, _Default) else v
          for k, v in kwargs.items()
      }
      if module is not None:
          return optimizer_type(module.parameters(), **opt_args)
      else:
          return optimizer_type(**opt_args)
  
file_path: garage/src/garage/_functions.py
imports: from collections import defaultdict
  import time
  import click
  from dowel import tabular
  import numpy
  from garage import EpisodeBatch, StepType
  from garage.np import discount_cumsum, stack_tensor_dict_list
label_desc: Use image node_id 1 for calling a global function with example usage: make_optimizer(optimizer_type, module) and returns: optimizer_type, optimizer_type, opt_type, opt_type