def METHOD_NAME(days, serialized_event_request):
    min_date = get_min_date(days)
    payload = {"days": days, "min_date": min_date}
    post_cleanup_started_event(payload.copy(), serialized_event_request)
    payload["tables"] = {}
    def result_callback(key, val):
        payload["tables"][key] = val
    with connection.cursor() as cursor:
        payload["duration"] = do_cleanup_inventory(cursor, result_callback, min_date)
    post_cleanup_finished_event(payload, serialized_event_request)
    return payload