Perform inheritance of sets.  Returns a list of items 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 set
                          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
                        item, 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_set(base, namespace, attr_name,
                    inherit=lambda i: True):
        """
        Perform inheritance of sets.  Returns a list of items 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 set
                          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
                        item, 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 sets to compare
        base_set = getattr(base, attr_name, set())
        new_set = namespace.setdefault(attr_name, set())
        for item in base_set:
            # Skip items that have been overridden or that we
            # shouldn't inherit
            if item in new_set or (inherit and not inherit(item)):
                continue

            # Inherit the item
            if inherit:
                new_set.add(item)

            items.append(item)

        return items