'Filter the given member list.
Members are skipped if
- they are private (except if given explicitly or the private-members
option is set)
- they are special methods (except if given explicitly or the
special-members option is set)
- they are undocumented (except if the undoc-members option is set)
The user can override the skipping decision by connecting to the
``autodoc-skip-member`` event.'

def filter_members(self, members, want_all):

    ret = []
    namespace = '.'.join(self.objpath)
    if self.analyzer:
        attr_docs = self.analyzer.find_attr_docs()
    else:
        attr_docs = {}
    for (membername, member) in members:
        isattr = False
        doc = self.get_attr(member, '__doc__', None)
        cls = self.get_attr(member, '__class__', None)
        if cls:
            cls_doc = self.get_attr(cls, '__doc__', None)
            if (cls_doc == doc):
                doc = None
        has_doc = bool(doc)
        keep = False
        if (want_all and membername.startswith('__') and membername.endswith('__') and (len(membername) > 4)):
            if ((self.options.special_members is ALL) and (membername != '__doc__')):
                keep = (has_doc or self.options.undoc_members)
            elif (self.options.special_members and (self.options.special_members is not ALL) and (membername in self.options.special_members)):
                keep = (has_doc or self.options.undoc_members)
        elif (want_all and membername.startswith('_')):
            keep = (self.options.private_members and (has_doc or self.options.undoc_members))
        elif ((namespace, membername) in attr_docs):
            keep = True
            isattr = True
        else:
            keep = (has_doc or self.options.undoc_members)
        if self.env.app:
            skip_user = self.env.app.emit_firstresult('autodoc-skip-member', self.objtype, membername, member, (not keep), self.options)
            if (skip_user is not None):
                keep = (not skip_user)
        if keep:
            ret.append((membername, member, isattr))
    return ret
