‘filepath’ not used ---> def write_events_to_file(filepath, ampevents): with open(events_path, "w") as file: json.dump(ampevents, file, indent=2)