from typing import OrderedDict


def read_config(config_file_path):
    """ Function read a SU2 configuration file

    Function 'read_config' return a dictionary of the data found in the SU2
    configuration file.

    Args:
        config_file_path (str):  SU2 configuration file path

    Returns:
        data_dict (dict): Dictionary of the data from the SU2 configuration file

    """

    data_dict = OrderedDict()
    with open(config_file_path, 'r') as f:
        for line in f:
            if line.startswith('%') or '=' not in line:
                continue
            key, value = line.split('=')
            if '(' in value:
                new_value = value.split('(')[1].split(')')[0]
                value_list = new_value.split(',')
                strip_value_list = [item.strip() for item in value_list]
                data_dict[key.strip()] = strip_value_list
            else:
                data_dict[key.strip()] = value.strip()
    return data_dict