'This function determines if we can use DiffLib to evaluate responses
If not possible Error base detection will be used.
:return: The function that should be used to compare responses. This
function will return True when the response body passed as
parameter contains an XPATH error.'

def _configure_is_error_function(self, vuln, count):

    diff_ratio = 0.0
    mutant = vuln.get_mutant()
    mutant.set_token_value(vuln.get_mutant().get_token_original_value())
    om.out.debug('Testing    if    body    dynamically    changes.')
    try:
        base_res = self._uri_opener.send_mutant(mutant)
        for _ in xrange(count):
            req_x = self._uri_opener.send_mutant(mutant)
            diff_ratio += difflib.SequenceMatcher(None, base_res.get_body(), req_x.get_body()).ratio()
    except BaseFrameworkException as e:
        om.out.debug(('Error    "%s"' % e))
    except RuntimeError as rte:
        issue = 'https://github.com/andresriancho/w3af/issues/5278'
        msg = 'An    unhandled    exception    occurred    while    trying    to    setup    the    error    detection    for    XPATH    injection.    This    situation    is    very    strange,    but    others    have    reported    it    in    the    past.\n\nThe    exception    message    is:    "%s"Please    help    us    fix    this    issue    by    adding    a    comment    with    the    steps    to    reproduce    it    and    the    exception    message    to    %s\n\n'
        om.out.console((msg % (issue, rte)))
    else:
        use_difflib = False
        ier = IsErrorResponse(vuln, self._uri_opener, use_difflib)
        is_error_resp = ier.is_error_response
        return is_error_resp
