code: def _maybe_unwrap_optimized(model: object) -> "pl.LightningModule":
      if not _TORCH_GREATER_EQUAL_2_0:
          if not isinstance(model, pl.LightningModule):
              _check_mixed_imports(model)
              raise TypeError(
                  f"`model` must be a `LightningModule`, got `{type(model).__qualname__}`"
              )
          return model
      from torch._dynamo import OptimizedModule
  
      if isinstance(model, OptimizedModule):
          return from_compiled(model)
      if isinstance(model, pl.LightningModule):
          return model
      _check_mixed_imports(model)
      raise TypeError(
          f"`model` must be a `LightningModule` or `torch._dynamo.OptimizedModule`, got `{type(model).__qualname__}`"
      )
  
file_path: pytorch-lightning/src/lightning/pytorch/utilities/compile.py
imports: from typing import Union
  import torch
  import lightning.pytorch
  from lightning.fabric.utilities.imports import _TORCH_GREATER_EQUAL_2_0, _TORCH_GREATER_EQUAL_2_1
  from lightning.pytorch.strategies import DDPStrategy, DeepSpeedStrategy, FSDPStrategy, SingleDeviceStrategy, Strategy
  from lightning.pytorch.utilities.model_helpers import _check_mixed_imports
label_desc: Use image node_id 3 for calling a global function with example usage: _maybe_unwrap_optimized(model) and returns: model, from_compiled, model