def csv2dict(filename, key_column, val_column, lower=True, header=True): #---<<<
    """
    Create a dictionary from two columns in a CSV file.

    filename = name of .CSV file
    key_column = column # (0-based) for dictionary keys
    val_column = column # (0-based) for dictionary values
    lower = whether to make the keys lowercase
    header = whether .CSV file has a header row as the first line

    Returns the dictionary.
    """
    thedict = dict()
    firstline = True
    for line in open(filename, 'r').readlines():
        if firstline and header:
            firstline = False
            continue # skip over the header line
        key_val = line.split(',')[key_column].strip()
        val_val = line.split(',')[val_column].strip()
        if lower:
            thedict[key_val.lower()] = val_val
        else:
            thedict[key_val] = val_val
    return thedict