def __init__(self,
                 wrapped_func,              # type: Callable
                 wrong_value,               # type: Any
                 validation_outcome=False,  # type: Any
                 help_msg=None,             # type: str
                 **kw_context_args):
        """
        Creates a WrappingFailure associated with failed validation of `wrong_value` by `wrapped_func`. Additional
        details about the validation outcome (result or exception) can be provided in validation_outcome.

        Contextual information may be provided as keyword arguments, and will be stored as fields in the created
        exception instance. An optional help message can be provided as an argument, and will be formatted using the
        dictionary of contextual information provided + the `wrapped_func`, `wrong_value` and `validation_outcome`
        keywords. If `help_msg` is not provided, the `help_msg` class field will be used and formatted the same way.

        If `validation_outcome` is an Exception, it will be set as the `__cause__` of the created exception, so that
        users of this class do not need to use `raise ... from ...`.

        :param wrapped_func: the validation function that failed validation.
        :param wrong_value: the value that was validated by `wrapped_func` and for which the validation failed
        :param validation_outcome: the caught result of `wrapped_func(wrong_value)`: either a caught exception or a
        variable different than `True` or `None`). Default is `False` for convenience.
        :param help_msg: an optional help message specific to this failure. If not provided, the class attribute
        `help_msg` will be used. This behaviour may be redefined by subclasses by overriding `get_help_msg`
        :param kw_context_args: optional contextual informations to store in the exception, and that may be also used
        to format the help message
        """

        # store details in the object for future access if needed
        self.wrapped_func = wrapped_func
        self.validation_outcome = validation_outcome

        # call super constructor
        super(WrappingFailure, self).__init__(wrong_value=wrong_value, help_msg=help_msg, **kw_context_args)

        # automatically set the exception as the cause, so that we can forget to "raise from"
        if isinstance(validation_outcome, Exception):
            self.__cause__ = validation_outcome
def __init__ ( self , wrapped_func , wrong_value , validation_outcome = False , help_msg = None , ** kw_context_args ) : self . wrapped_func = wrapped_func self . validation_outcome = validation_outcome super ( WrappingFailure , self ) . __init__ ( wrong_value = wrong_value , help_msg = help_msg , ** kw_context_args ) if isinstance ( validation_outcome , Exception ) : self . __cause__ = validation_outcome
Creates a WrappingFailure associated with failed validation of `wrong_value` by `wrapped_func`. Additional
        details about the validation outcome (result or exception) can be provided in validation_outcome.

        Contextual information may be provided as keyword arguments, and will be stored as fields in the created
        exception instance. An optional help message can be provided as an argument, and will be formatted using the
        dictionary of contextual information provided + the `wrapped_func`, `wrong_value` and `validation_outcome`
        keywords. If `help_msg` is not provided, the `help_msg` class field will be used and formatted the same way.

        If `validation_outcome` is an Exception, it will be set as the `__cause__` of the created exception, so that
        users of this class do not need to use `raise ... from ...`.

        :param wrapped_func: the validation function that failed validation.
        :param wrong_value: the value that was validated by `wrapped_func` and for which the validation failed
        :param validation_outcome: the caught result of `wrapped_func(wrong_value)`: either a caught exception or a
        variable different than `True` or `None`). Default is `False` for convenience.
        :param help_msg: an optional help message specific to this failure. If not provided, the class attribute
        `help_msg` will be used. This behaviour may be redefined by subclasses by overriding `get_help_msg`
        :param kw_context_args: optional contextual informations to store in the exception, and that may be also used
        to format the help message