def dict_union(a, b):
    """
    Return the union of two dictionaries without editing either.
    If a key exists in both dictionaries, the second value is used.
    """
    if not a:
        return b if b else {}
    if not b:
        return a
    ret = a.copy()
    ret.update(b)
    return ret