import re


def smart_format(raw: str, dic: dict) -> str:
    """
    Example:
        smart_format("{name}-{c}-{age}", {"name": "Jeyrce.Lu"})
        > Jeyrce.Lu-{c}-{age}
    :param raw: 待格式化字符串
    :param dic: 传入的格式化字典
    :return 格式化完成的字符串
    """
    keys = re.findall("{(.*?)}", raw)
    for k in keys:
        if k not in dic:
            dic[k] = f"{{{k}}}"
    return raw.format(**dic)