<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_csv(header, contents, sep=",", filename="stdout", thousands=False, tee=False, align=True, comment=False):
 """ Write csv that are aligned with the column headers. x_value, y_value 1, 100 2, 200 """

    from jcvi.formats.base import must_open

    formatted = load_csv(header, contents,
                         sep=sep, thousands=thousands, align=align)
    if comment:
        formatted[0] = '#' + formatted[0][1:]
    formatted = "\n".join(formatted)
    fw = must_open(filename, "w")
    print(formatted, file=fw)
    if tee and filename != "stdout":
        print(formatted)