See custom_inherit.style_store.reST for details.

def merge_rest_docs(prnt_doc=None, child_doc=None):
    """ See custom_inherit.style_store.reST for details. """
    prnt_sections = parse_rest_doc(prnt_doc)
    child_sections = parse_rest_doc(child_doc)

    header = prnt_sections['']
    prnt_sections.update(child_sections)
    if not child_sections[''].body:
        prnt_sections[''] = header
        if not header.body:
            prnt_sections.popitem(last=False)

    return "\n\n".join(("\n".join((x.header, x.body)) for x in prnt_sections.values())).lstrip()