'Generic runner for fuzzy string diff which adds noise to the cmp'

def generic_fuzzy_string_diff_runner_noise(self, fuzzy_func, ratio):

    failed_domains = set()
    total = 0
    start = time.time()
    for (domain, (ok, _)) in self.not_exists_data.iteritems():
        total += 1
        ok = self._gunzip(ok)
        ok_resp = self._create_http_response(domain, ok, False)
        ok_with_noise = self._add_noise_to_str(ok, 10, 12)
        ok_noise_resp = self._create_http_response(domain, ok_with_noise, True)
        clean_body_ok = get_clean_body(ok_resp)
        clean_body_noise = get_clean_body(ok_noise_resp)
        if (not fuzzy_func(clean_body_noise, clean_body_ok, ratio)):
            failed_domains.add(domain)
    end = time.time()
    perc_fail = (len(failed_domains) / total)
    func_name = fuzzy_func.__name__
    print ('%s    fail    rate:    %s' % (func_name, perc_fail))
    print ('Total    time:    %ss' % (end - start))
    print ('Analyzed    samples:    %s' % total)
    output = ('/tmp/%s.txt' % func_name)
    output_fh = file(output, 'w')
    for domain in sorted(failed_domains):
        output_fh.write(('%s\n' % domain))
    print ('Failed    domains    stored    at    %s' % output)
