code: def write_csv(record: str, fields: List[Any]):
      record_arg = f"output_{record}s"
      fname = os.path.join(args.output_dir, getattr(args, record_arg))
      print("Writing:", fname)
      with open(fname, "w") as fp:
          writer = csv.DictWriter(
              fp, fieldnames=[record, "key"], lineterminator="\n"
          )
          writer.writeheader()
          for f in fields:
              # let's skip private fields
              if f.name.startswith("_"):
                  continue
              writer.writerow({record: f.name, "key": f.number})
  
imports: import argparse
  import csv
  import os
  from typing import Any, List
  from wandb.proto import wandb_telemetry_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: write_csv(record, fields) without return types