code: def checked_cast_optional(
      typ: Type[T], val: Optional[V]
  ) -> Optional[T]:
      """Calls checked_cast only if value is not None."""
      if val is None:
          return val
      return checked_cast(typ, val)
  
file_path: Ax/ax/utils/common/typeutils.py
imports: from inspect import signature
  from typing import Any, Dict, List, Optional, Tuple, Type, TypeVar
  import numpy
  from typeguard import check_type
label_desc: Use image node_id 3 for calling a global function with example usage: checked_cast_optional(typ, val) and returns: checked_cast, val