code: def _validate_scheduler_api(
      lr_scheduler_configs: List[LRSchedulerConfig],
      model: "pl.LightningModule",
  ) -> None:
      for config in lr_scheduler_configs:
          scheduler = config.scheduler
          if not isinstance(scheduler, _Stateful):
              raise TypeError(
                  f"The provided lr scheduler `{scheduler.__class__.__name__}` is invalid."
                  " It should have `state_dict` and `load_state_dict` methods defined."
              )
  
          if (
              not isinstance(scheduler, LRSchedulerTypeTuple)
              and not is_overridden("lr_scheduler_step", model)
              and model.automatic_optimization
          ):
              raise MisconfigurationException(
                  f"The provided lr scheduler `{scheduler.__class__.__name__}` doesn't follow PyTorch's LRScheduler"
                  " API. You should override the `LightningModule.lr_scheduler_step` hook with your own logic if"
                  " you are using a custom LR scheduler."
              )
  
imports: from contextlib import contextmanager
  from dataclasses import fields
  from typing import Any, Callable, Dict, Generator, List, Optional, Tuple, Union, overload
  from weakref import proxy
  import torch
  from torch import optim
  from torch.optim import Optimizer
  from typing_extensions import override
  import lightning.pytorch
  from lightning.fabric.utilities.types import Optimizable, ReduceLROnPlateau, _Stateful
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning.pytorch.utilities.model_helpers import is_overridden
  from lightning.pytorch.utilities.rank_zero import rank_zero_warn
  from lightning.pytorch.utilities.signature_utils import is_param_in_hook_signature
  from lightning.pytorch.utilities.types import LRSchedulerConfig, LRSchedulerTypeTuple
label_desc: Use image node_id 6 for calling a global function with example usage: _validate_scheduler_api(lr_scheduler_configs, model) without return types