Shortcut method to return ``Some`` or :py:data:`NONE` based on ``val``.

        Args:
            val: Some value.

        Returns:
            ``Some(val)`` if the ``val`` is not None, otherwise :py:data:`NONE`.

        Examples:
            >>> Option.maybe(0)
            Some(0)
            >>> Option.maybe(None)
            NONE

def maybe(cls, val: Optional[T]) -> 'Option[T]':
        """
        Shortcut method to return ``Some`` or :py:data:`NONE` based on ``val``.

        Args:
            val: Some value.

        Returns:
            ``Some(val)`` if the ``val`` is not None, otherwise :py:data:`NONE`.

        Examples:
            >>> Option.maybe(0)
            Some(0)
            >>> Option.maybe(None)
            NONE
        """
        return cast('Option[T]', NONE) if val is None else cls.Some(val)