<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def collect_config(cfg):
 """ Construct configuration dictionary from configparser. Resolves presets and returns a dictionary containing: .. code-block:: bash { "client_name": { "detector": ("detector_name", detector_opts), "updater": [ ("updater_name", updater_opts), ] }, } :param cfg: ConfigParser """

    collected_configs = {}
    _updater_str = "updater"
    _detector_str = "detector"
    _dash = "-"
    for client_name, client_cfg_dict in _iraw_client_configs(cfg):
        detector_name = None
        detector_options = {}
        updater_name = None
        updater_options = {}
        collected_config = {}
        for k in client_cfg_dict:
            if k.startswith(_detector_str + _dash):
                detector_options[
                    k.replace(_detector_str + _dash, "")] = client_cfg_dict[k]
            elif k == _updater_str:
                updater_name = client_cfg_dict.get(k)
            elif k == _detector_str:
                detector_name = client_cfg_dict.get(k)
            elif k.startswith(_updater_str + _dash):
                updater_options[
                    k.replace(_updater_str + _dash, "")] = client_cfg_dict[k]
            else:
                # options passed "as is" to the dyndnsc client
                collected_config[k] = client_cfg_dict[k]

        collected_config[_detector_str] = [(detector_name, detector_options)]
        collected_config[_updater_str] = [(updater_name, updater_options)]

        collected_configs[client_name] = collected_config
    return collected_configs