'Generate reST for the object given by *self.name*, and possibly for
its members.
If *more_content* is given, include that content. If *real_modname* is
given, use that module name to find attribute docs. If *check_module* is
True, only generate if the object is defined in the module name it is
imported from. If *all_members* is True, document all members.'

def generate(self, more_content=None, real_modname=None, check_module=False, all_members=False):

    if (not self.parse_name()):
        self.directive.warn(('don\'t    know    which    module    to    import    for    autodocumenting    %r    (try    placing    a    "module"    or    "currentmodule"    directive    in    the    document,    or    giving    an    explicit    module    name)' % self.name))
        return
    if (not self.import_object()):
        return
    self.real_modname = (real_modname or self.get_real_modname())
    try:
        self.analyzer = ModuleAnalyzer.for_module(self.real_modname)
        self.analyzer.find_attr_docs()
    except PycodeError as err:
        logger.debug('[autodoc]    module    analyzer    failed:    %s', err)
        self.analyzer = None
        if (hasattr(self.module, '__file__') and self.module.__file__):
            self.directive.filename_set.add(self.module.__file__)
    else:
        self.directive.filename_set.add(self.analyzer.srcname)
    if check_module:
        if (not self.check_module()):
            return
    sourcename = self.get_sourcename()
    self.add_line(u'', sourcename)
    sig = self.format_signature()
    self.add_directive_header(sig)
    self.add_line(u'', sourcename)
    self.indent += self.content_indent
    self.add_content(more_content)
    self.document_members(all_members)
