code: def not_none(val: Optional[T], message: Optional[str] = None) -> T:
      """
      Unbox an optional type.
  
      Args:
        val: the value to cast to a non ``None`` type
        message: optional override of the default error message
      Returns:
        V:  ``val`` when ``val`` is not ``None``
      Throws:
        ValueError if ``val`` is ``None``
      """
      if val is None:
          raise ValueError(
              message or "Argument to `not_none` was None."
          )
      return 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 1 for calling a global function with example usage: not_none(val, message) and returns: val