code: def _get_work_file(work: "LightningWork") -> Optional[str]:
      cls = work.__class__
      try:
          return inspect.getfile(cls)
      except TypeError:
          logger.debug(f"The {cls.__name__} file couldn't be found.")
          return None
  
imports: import inspect
  import os
  import re
  from dataclasses import asdict, dataclass, field
  from pathlib import Path
  from typing import TYPE_CHECKING, Dict, List, Optional, Union
  from typing_extensions import Self
  from lightning.app.utilities.app_helpers import Logger
  from lightning.app.utilities.packaging.cloud_compute import CloudCompute
label_desc: Use image node_id 2 for calling a global function with example usage: _get_work_file(work) and returns: inspect, None