def _print_csv(result):
    """Print a JSON list of JSON objects in CSV format."""
    if type(result) is not list:
        raise TypeError("output not able to be displayed as CSV.")
    first_line = result[0]
    w = csv.DictWriter(sys.stdout, fieldnames=sorted(first_line.keys()))
    w.writeheader()
    for line in result:
        w.writerow(line)