code: def separated_format(table_data: TableData, delim: str) -> str:
      output = io.StringIO()
      writer = csv.writer(output, delimiter=delim)
      assert len(table_data) > 0
      header = table_data[0].keys()
      writer.writerow(header)
      for d in table_data:
          writer.writerow(d.values())
  
      contents = output.getvalue()
      output.close()
      return contents
  
imports: import json
  from enum import Enum
  import yaml
  import csv
  from typing import Any, List, Dict, Callable, Annotated
  import tabulate
  import io
  from typer import Option
label_desc: Use image node_id 4 for calling a global function with example usage: separated_format(table_data, delim) and returns: contents