def _merge_dict(a, b):
    """
    Given two dicts, merge them into a new dict as a
    shallow copy. Keys on dictionary b will overwrite keys
    on dictionary a.

    :param a: a dictionary, may be None
    :type a: None | dict
    :param b: a dictionary, may be None
    :type b: None | dict
    :return: the result of merging a with b
    :rtype: dict
    """
    if a is None and b is None:
        return {}

    if a is None:
        return b.copy()

    if b is None:
        return a.copy()

    z = a.copy()
    z.update(b)
    return z