from typing import Mapping
from typing import Any


def merge_dict(
    d1: Mapping[Any, Any], d2: Mapping[Any, Any], stringify_vals: bool = False
) -> Mapping[Any, Any]:
    """
    A simple shallow dictionary merger that replaces/appends values in d1 with
    those overridden or combined in d2 and returns the resulting output dict.
    """
    if stringify_vals:
        for v in d1.values():
            v = str(v)
        for v in d2.values():
            v = str(v)
    return {**d1, **d2}