import csv


def get_c_source_concentrations(input_file):
    """
    Set range concentration range for the carbon source

    The concentration range of the metabolites are 
    needed for MDF calculations. Those have to be added in 
    the input file under c_source_concentration_range
    ------------------------------------------------
    Argument:
    input_file--str input file in .csv format dictionary like

    Return:
    c_range: dictionary with 'min' and 'max' as keys and the 
        intracellular concentrations in uM as values
    """
    with open(input_file, newline='', encoding='utf-8-sig') as csvfile:
            reader = csv.DictReader(csvfile, dialect='excel')
            c_range = {}
            for row in reader:
                if row['c_source_concentration_range'] != '':
                    concentrations = str(row['c_source_concentration_range']).split()
                    c_range['min'] = concentrations[0]
                    c_range['max'] = concentrations[1]
    return c_range