def write_workbook_rels(workbook):
    """Write the workbook relationships xml."""
    root = Element('Relationships', xmlns=PKG_REL_NS)

    for i, _ in enumerate(workbook.worksheets, 1):
        rel = Relationship(type='worksheet', target='worksheets/sheet%s.xml' % i, id='rId%d' % i)
        root.append(rel.to_tree())

    i += 1
    strings =  Relationship(type='sharedStrings', target='sharedStrings.xml', id='rId%d' % i)
    root.append(strings.to_tree())

    i += 1
    styles =  Relationship(type='styles', target='styles.xml', id='rId%d' % i)
    root.append(styles.to_tree())

    i += 1
    styles =  Relationship(type='theme', target='theme/theme1.xml', id='rId%d' % i)
    root.append(styles.to_tree())

    if workbook.vba_archive:
        i += 1
        vba =  Relationship(type='vbaProject', target='vbaProject.bin', id='rId%d' % i)
        vba.type ='http://schemas.microsoft.com/office/2006/relationships/vbaProject'
        root.append(vba.to_tree())

    external_links = workbook._external_links
    if external_links:
        for idx, link in enumerate(external_links, 1):
            ext =  Relationship(type='externalLink',
                                target='externalLinks/externalLink%d.xml' % idx,
                                id='rId%d' % (i +idx))
            root.append(ext.to_tree())

    return tostring(root)
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/openpyxl-2.3.0-b2/openpyxl/writer/workbook.py/write_workbook_rels/original