code: def is_scheduler(optimizer) -> bool:
      """
      Helper method to determine whether a PyTorch object is either a PyTorch
      optimizer (return false) or a optimizer wrapped in an LRScheduler e.g. a
      ``ReduceLROnPlateau`` or subclasses of ``_LRScheduler`` (return true).
      """
      # This uses duck typing rather than isinstance() because (1) PyTorch
      # provides no comprehensive class hierarchy, and (2) the base class
      # _LRScheduler of the majority of schedulers is private.
      return hasattr(optimizer, "optimizer")
  
imports: import inspect
  from typing import Any, Callable, Dict, Iterable, List, Optional, Type, Union, ValuesView
  import torch
  from torch import Tensor
  from torch.nn.utils import clip_grad_norm_, clip_grad_value_
  from torch.optim import Optimizer
  import pyro
  from pyro.optim.adagrad_rmsprop import AdagradRMSProp
  from pyro.optim.clipped_adam import ClippedAdam
  from pyro.optim.dct_adam import DCTAdam
  from pyro.params.param_store import module_from_param_with_module_name, normalize_param_name, user_param_name
label_desc: Use image node_id 1 for calling a global function with example usage: is_scheduler(optimizer) and returns: hasattr