def scrub(args, send_notif=lambda x: None):
    print "Starting scrub."
    start = utils.str_time_to_unix(args.start)
    end = utils.str_time_to_unix(args.end)

    if hasattr(scrubbers, args.scrubber):
        Scrubber = getattr(scrubbers, args.scrubber)
        scrubber = Scrubber(start, end)

        count = 0
        for raw in scrubber.raws():
            matches, body = scrubber.filter(raw)
            if matches and not body:
                body = json.loads(raw['json'])[1]
            if matches and body:
                scrubbed = scrubber.scrub(body)
                count += 1
                send_notif(scrubbed)
        return count
    else:
        print "No scrubber class %s." % args.scrubber
        return 0
dataset/ETHPy150Open openstack/stacktach/scripts/notification_scrubber.py/scrub/original