Recursively merges dicts. not just simple a['key'] = b['key'], if
    both a and b have a key who's value is a dict then dict_merge is called
    on both values and the result stored in the returned dictionary.

    Also, if keys contain `self._dict_boundary`, they will be split into
    sub dictionaries.

    :param a:
    :param b:
    :return:

def dict_merge(a, b, dict_boundary):
    """
    Recursively merges dicts. not just simple a['key'] = b['key'], if
    both a and b have a key who's value is a dict then dict_merge is called
    on both values and the result stored in the returned dictionary.

    Also, if keys contain `self._dict_boundary`, they will be split into
    sub dictionaries.

    :param a:
    :param b:
    :return:
    """
    if not isinstance(b, dict):
        return b

    result = deepcopy(a)

    for k, v in b.iteritems():
        exploded_k = k.split(dict_boundary)

        if len(exploded_k) > 1:
            new_dict = None

            #@todo: seem to be clobbering existing data with this one... fix it
            for key in reversed(exploded_k):
                if not key:
                    continue

                if not new_dict:
                    new_dict = OrderedDict([(key, v)])
                else:
                    new_dict = OrderedDict([(key, deepcopy(new_dict))])

            result = dict_merge(result, new_dict, dict_boundary)
        elif k in result and isinstance(result[k], dict):
            result[k] = dict_merge(result[k], v, dict_boundary)
        else:
            result[k] = deepcopy(v)

    return result