<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def man_sections_from_cmdln(inst, summary=None, description=None, author=None):
 """Return man page sections appropriate for the given Cmdln instance. Join these sections for man page content. The man page sections generated are: NAME SYNOPSIS DESCRIPTION (if `description` is given) OPTIONS COMMANDS HELP TOPICS (if any) @param inst {Cmdln} Instance of Cmdln subclass for which to generate man page content. @param summary {str} A one-liner summary of the command. @param description {str} A description of the command. If given, it will be used for a "DESCRIPTION" section. @param author {str} The author name and email for the AUTHOR secion of the man page. @raises {ValueError} if man page content cannot be generated for the given class. """

    if not inst.__class__.name:
        raise ValueError("cannot generate man page content: `name` is not "
                         "set on class %r" % inst.__class__)
    data = {
        "name": inst.name,
        "ucname": inst.name.upper(),
        "date": datetime.date.today().strftime("%b %Y"),
        "cmdln_version": __version__,
        "version_str": inst.version and " %s" % inst.version or "",
        "summary_str": summary and r" \- %s" % summary or "",
    }

    sections = []
    sections.append(
        '.\\" Automatically generated by cmdln %(cmdln_version)s\n'
        '.TH %(ucname)s "1" "%(date)s" "%(name)s%(version_str)s" "User Commands"\n'
        % data)
    sections.append(".SH NAME\n%(name)s%(summary_str)s\n" % data)
    sections.append(_dedent(r"""
        .SH SYNOPSIS
        .B %(name)s
        [\fIGLOBALOPTS\fR] \fISUBCOMMAND \fR[\fIOPTS\fR] [\fIARGS\fR...]
        .br
        .B %(name)s
        \fIhelp SUBCOMMAND\fR
        """) % data)
    if description:
        sections.append(".SH DESCRIPTION\n%s\n" % description)

    section = ".SH OPTIONS\n"
    if not hasattr(inst, "optparser") is None:
        #HACK: In case `.main()` hasn't been run.
        inst.optparser = inst.get_optparser()
    lines = inst._help_preprocess("${option_list}", None).splitlines(False)
    for line in lines[1:]:
        line = line.lstrip()
        if not line:
            continue
        section += ".TP\n"
        opts, desc = line.split('  ', 1)
        section += ".B %s\n" % opts
        section += "%s\n" % _dedent(desc.lstrip(), skip_first_line=True)
    sections.append(section)

    section = ".SH COMMANDS\n"
    cmds = inst._get_cmds_data()
    for cmdstr, doc in cmds:
        cmdname = cmdstr.split(' ')[0]  # e.g. "commit (ci)" -> "commit"
        doc = inst._help_reindent(doc, indent="")
        doc = inst._help_preprocess(doc, cmdname)
        doc = doc.rstrip() + "\n"  # trim down trailing space
        section += '.PP\n.SS %s\n%s\n' % (cmdstr, doc)
    sections.append(section)

    help_names = inst._get_help_names()
    if help_names:
        section = ".SH HELP TOPICS\n"
        for help_name, help_meth in sorted(help_names.items()):
            help = help_meth(inst)
            help = inst._help_reindent(help, indent="")
            section += '.PP\n.SS %s\n%s\n' % (help_name, help)
        sections.append(section)

    if author:
        sections.append(".SH AUTHOR\n%s\n" % author)

    return sections