<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_dois(csv_source, write_file=True):
 """ Get DOI publication info for a batch of DOIs. This is LiPD-independent and only requires a CSV file with all DOIs listed in a single column. The output is LiPD-formatted publication data for each entry. :param str csv_source: Local path to CSV file :param bool write_file: Write output data to JSON file (True), OR pretty print output to console (False) :return none: """


    _dois_arr = []
    _dois_raw = []

    # open the CSV file
    with open(csv_source, "r") as f:
        reader = csv.reader(f)
        for row in reader:
            # sort the DOIs as an array of DOI strings
            _dois_arr.append(row[0])

    # run the DOI resolver once for each DOI string.
    for _doi in _dois_arr:
        _dois_raw.append(_update_doi(_doi))

    if write_file:
        # Write the file
        new_filename = os.path.splitext(csv_source)[0]
        write_json_to_file(_dois_raw, new_filename)

    else:
        print(json.dumps(_dois_raw, indent=2))

    return