code: def _optimizer_handles_unscaling(optimizer: Any) -> bool:
      """Determines whether a PyTorch optimizer handles unscaling gradients in the step method rather than through the
      :class:`torch.cuda.amp.GradScaler`.
  
      Since, the current implementation of this function checks a PyTorch internal variable on the optimizer, the return
      value will only be reliable for built-in PyTorch optimizers.
  
      """
      return getattr(optimizer, "_step_supports_amp_scaling", False)
  
imports: from typing import Any, ContextManager, Dict, Literal, Optional
  import torch
  from lightning_utilities.core.apply_func import apply_to_collection
  from torch import Tensor
  from torch.nn import Module
  from torch.optim import LBFGS, Optimizer
  from typing_extensions import override
  from lightning.fabric.accelerators.cuda import _patch_cuda_is_available
  from lightning.fabric.plugins.precision.precision import Precision
  from lightning.fabric.plugins.precision.utils import _convert_fp_tensor
  from lightning.fabric.utilities.types import Optimizable
label_desc: Use image node_id 1 for calling a global function with example usage: _optimizer_handles_unscaling(optimizer) and returns: getattr