def build_template(cfg: dict) -> dict:
    """
    Build string's template dictionary
    :rtype: dict
    :param cfg: representation of the config
    :return: dictionary to be used with Template().substutute() function
    """
    task = cfg['main']

    def concat(*dictionaries: dict) -> dict:
        res = dict()
        for d in dictionaries:
            res = {**res, **d}
        return res

    template = concat(task['miner'], task['pool'], cfg['rig'])
    return template