def diff_config(base, target):
    '''Find the differences between two configurations.

    This finds a delta configuration from `base` to `target`, such that
    calling :func:`overlay_config` with `base` and the result of this
    function yields `target`.  This works as follows:

    * If both are identical (of any type), returns an empty dictionary.
    * If either isn't a dictionary, returns `target`.
    * Any key in `target` not present in `base` is included in the output
      with its value from `target`.
    * Any key in `base` not present in `target` is included in the output
      with value :const:`None`.
    * Any keys present in both dictionaries are recursively merged.

    >>> diff_config({'a': 'b'}, {})
    {'a': None}
    >>> diff_config({'a': 'b'}, {'a': 'b', 'c': 'd'})
    {'c': 'd'}

    :param dict base: original configuration
    :param dict target: new configuration
    :return: overlay configuration
    :returntype dict:

    '''
    if not isinstance(base, collections.Mapping):
        if base == target:
            return {}
        return target
    if not isinstance(target, collections.Mapping):
        return target
    result = dict()
    for k in iterkeys(base):
        if k not in target:
            result[k] = None
    for k, v in iteritems(target):
        if k in base:
            merged = diff_config(base[k], v)
            if merged != {}:
                result[k] = merged
        else:
            result[k] = v
    return result
Find the differences between two configurations.

    This finds a delta configuration from `base` to `target`, such that
    calling :func:`overlay_config` with `base` and the result of this
    function yields `target`.  This works as follows:

    * If both are identical (of any type), returns an empty dictionary.
    * If either isn't a dictionary, returns `target`.
    * Any key in `target` not present in `base` is included in the output
      with its value from `target`.
    * Any key in `base` not present in `target` is included in the output
      with value :const:`None`.
    * Any keys present in both dictionaries are recursively merged.

    >>> diff_config({'a': 'b'}, {})
    {'a': None}
    >>> diff_config({'a': 'b'}, {'a': 'b', 'c': 'd'})
    {'c': 'd'}

    :param dict base: original configuration
    :param dict target: new configuration
    :return: overlay configuration
    :returntype dict: