def merge_configs(default_config, input_config):
    """Recursively merge configuration dictionaries"""
    result = {}
    for name in default_config:
        lhs_value = default_config[name]
        if name in input_config:
            rhs_value = input_config[name]
            if isinstance(lhs_value, dict):
                assert isinstance(rhs_value, dict)
                result[name] = merge_configs(lhs_value, rhs_value)
            else:
                result[name] = rhs_value
        else:
            result[name] = lhs_value

    for name in input_config:
        rhs_value = input_config[name]
        if isinstance(rhs_value, dict) and name in default_config.keys():
            continue

        result[name] = rhs_value

    return result