<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 headers, # type: Iterable[str] file # type: TextIO ):
 """ Output generated data to file as CSV with header. :param data: An iterable of tuples containing raw data. :param headers: Iterable of feature names :param file: A writeable stream in which to write the CSV """


    print(','.join(headers), file=file)
    writer = csv.writer(file)
    writer.writerows(data)