def raise_exception_if(self, exname, condition, edata=None, _keys=None):
<EOL>if not isinstance(condition, bool):<EOL><INDENT>raise RuntimeError("<STR_LIT>")<EOL><DEDENT>if not self._validate_edata(edata):<EOL><INDENT>raise RuntimeError("<STR_LIT>")<EOL><DEDENT>if _keys is None:<EOL><INDENT>if not isinstance(exname, str):<EOL><INDENT>raise RuntimeError("<STR_LIT>")<EOL><DEDENT>func_id, func_name = self._get_ex_data()<EOL>name = "<STR_LIT>".format(func_id, self._callables_separator, exname)<EOL>for key, value in self._ex_dict[func_id].items():<EOL><INDENT>if value["<STR_LIT:name>"] == name:<EOL><INDENT>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>".format(exname=exname)<EOL>)<EOL><DEDENT>_keys = (func_id, key, func_name)<EOL><DEDENT>eobj = self._ex_dict[_keys[<NUM_LIT:0>]][_keys[<NUM_LIT:1>]]<EOL>if condition:<EOL><INDENT>eobj["<STR_LIT>"][eobj["<STR_LIT>"].index(_keys[<NUM_LIT:2>])] = True<EOL>self._raise_exception({"<STR_LIT:type>": _keys[<NUM_LIT:1>][<NUM_LIT:0>], "<STR_LIT>": _keys[<NUM_LIT:1>][<NUM_LIT:1>]}, edata)<EOL><DEDENT>
r"""
        Raise exception conditionally.

        :param exname: Exception name
        :type  exname: string

        :param condition: Flag that indicates whether the exception is
                          raised *(True)* or not *(False)*
        :type  condition: boolean

        :param edata: Replacement values for fields in the exception message
                      (see :py:meth:`pexdoc.ExHandle.add_exception` for how
                      to define fields). Each dictionary entry can only have
                      these two keys:

                      * **field** *(string)* -- Field name

                      * **value** *(any)* -- Field value, to be converted into
                        a string with the `format
                        <https://docs.python.org/2/library/stdtypes.html#
                        str.format>`_ string method

                      If None no field replacement is done
        :type  edata: dictionary, iterable of dictionaries or None

        :raises:
         * RuntimeError (Argument \\`condition\\` is not valid)

         * RuntimeError (Argument \\`edata\\` is not valid)

         * RuntimeError (Argument \\`exname\\` is not valid)

         * RuntimeError (Field *[field_name]* not in exception message)

         * ValueError (Exception name *[name]* not found')