Perform inheritance of dictionaries.  Returns a list of key
        and value pairs for values that were inherited, for
        post-processing.

        :param base: The base class being considered; see
                     ``iter_bases()``.
        :param namespace: The dictionary of the new class being built.
        :param attr_name: The name of the attribute containing the
                          dictionary to be inherited.
        :param inherit: Filtering function to determine if a given
                        item should be inherited.  If ``False`` or
                        ``None``, item will not be added, but will be
                        included in the returned items.  If a
                        function, the function will be called with the
                        key and value, and the item will be added and
                        included in the items list only if the
                        function returns ``True``.  By default, all
                        items are added and included in the items
                        list.

def inherit_dict(base, namespace, attr_name,
                     inherit=lambda k, v: True):
        """
        Perform inheritance of dictionaries.  Returns a list of key
        and value pairs for values that were inherited, for
        post-processing.

        :param base: The base class being considered; see
                     ``iter_bases()``.
        :param namespace: The dictionary of the new class being built.
        :param attr_name: The name of the attribute containing the
                          dictionary to be inherited.
        :param inherit: Filtering function to determine if a given
                        item should be inherited.  If ``False`` or
                        ``None``, item will not be added, but will be
                        included in the returned items.  If a
                        function, the function will be called with the
                        key and value, and the item will be added and
                        included in the items list only if the
                        function returns ``True``.  By default, all
                        items are added and included in the items
                        list.
        """

        items = []

        # Get the dicts to compare
        base_dict = getattr(base, attr_name, {})
        new_dict = namespace.setdefault(attr_name, {})
        for key, value in base_dict.items():
            # Skip keys that have been overridden or that we shouldn't
            # inherit
            if key in new_dict or (inherit and not inherit(key, value)):
                continue

            # Inherit the key
            if inherit:
                new_dict[key] = value

            # Save the item for post-processing
            items.append((key, value))

        return items