import configparser


def _read_config_file_section(section, config_file_path, items):
    """Read a configuration file section

    Arguments
    ---------
    section : str
        Name of the section to read
    config_file_path : str
        Absolute path to the config file
    items : list of str
        A list of names of the config items to read

    Returns
    -------
    dict
        Keys are the item names

    Raises
    ------
    ValueError if the configuration item does not exist in the file
    """
    data_paths = {}
    config = configparser.ConfigParser()
    config.read(config_file_path)
    for item, item_type in items:

        try:
            if item_type == 'str':
                data_paths[item] = config.get(section, item)
            elif item_type == 'bool':
                data_paths[item] = config.getboolean(section, item)
            elif item_type == 'int':
                data_paths[item] = config.getint(section, item)

        except configparser.NoOptionError:
            msg = "Option '{}' doesn't exist in section '{}' in '{}'"
            raise ValueError(msg.format(item, section, config_file_path))
        except configparser.NoSectionError:
            msg = "Section '{}' doesn't exist in '{}'"
            raise ValueError(msg.format(section, config_file_path))

    return data_paths