def merge_configs(*configs):
    """Merge configs in special format.

    It supports merging of configs in the following format:
    applicable_target -> config_name -> config_value

    """
    result = {}
    for config in configs:
        if config:
            for a_target in config:
                if a_target not in result or not result[a_target]:
                    result[a_target] = {}
                result[a_target].update(config[a_target])
    return result
