import configparser
from typing import Dict
from typing import Any


def ConfigParser_to_Dict(config: configparser.ConfigParser) -> Dict:
    """
    Convert ConfigParser object to dictionary.
    The resulting dictionary has sections as keys which point to a dict of the
    section options as key => value pairs.
    If there is a string representation of truth, it is converted from str to bool.
    """
    _dict: "Dict[str, Any]" = {}
    for section in config.sections():
        _dict[section] = {}
        for key, _value in config.items(section):
            try:
                _value = bool(strtobool(_value))  # type: ignore
            except ValueError:
                pass
            _dict[section][key] = _value
    return _dict