def uniquify_header(line):
    """Make names unique in a CSV header line."""
    fields = line.strip().split(",")
    for i, field in enumerate(fields):
        if field in fields[i + 1:]:
            count = 1
            for j in range(i, len(fields)):
                if fields[j] == field:
                    fields[j] = "{} [{}]".format(
                        field,
                        count
                    )
                    count += 1

    return ",".join(fields) + "\n"