Converts from :class:`Result` [T, E] to :class:`option.option_.Option` [E].

        Returns:
            :class:`Option` containing the error value if `self` is
            :meth:`Result.Err`, otherwise :data:`option.option_.NONE`.

        Examples:
            >>> Ok(1).err()
            NONE
            >>> Err(1).err()
            Some(1)

def err(self) -> Option[E]:
        """
        Converts from :class:`Result` [T, E] to :class:`option.option_.Option` [E].

        Returns:
            :class:`Option` containing the error value if `self` is
            :meth:`Result.Err`, otherwise :data:`option.option_.NONE`.

        Examples:
            >>> Ok(1).err()
            NONE
            >>> Err(1).err()
            Some(1)
        """
        return cast(Option[E], NONE) if self._is_ok else Option.Some(cast(E, self._val))