```python
def merge_dict(d1, d2):
    """
    Merges two dictionaries.

    If a key exists in both dictionaries, the value from the second dictionary (d2)
    will be used.

    Args:
        d1 (dict): The first dictionary.
        d2 (dict): The second dictionary.

    Returns:
        dict: A new dictionary containing the merged key-value pairs.
    """
    return {**d1, **d2}
```