def save_page(page, page_number, label, subset):
    """ Convert a tab of a glue session into a D3PO page

    :param page: Tuple of data viewers to save
    :param label: Tab label
    """
    result = {}

    # layout settings
    result['grid'] = {'nRows': 1, 'nColumns': len(page)}
    result['name'] = str(label)
    result['caption'] = 'Generated by Glue'

    # style settings
    d = page[0]._data[0]
    unselected = dict(opacity=d.style.alpha,
                      size=d.style.markersize / 2,
                      color=d.style.color)
    result['markerStyle'] = dict(unselected=unselected)

    if subset is not None:
        s = subset.style
        selected = dict(opacity=s.alpha, size=s.markersize / 2, color=s.color)
        result['markerStyle']['selected'] = selected
        result['selection'] = {'type': 'booleanColumn',
                               'columnName': 'selection_%i' % page_number}
    result['histogramStyle'] = result['markerStyle']

    # save each plot
    result['plots'] = list(map(save_plot, page, range(len(page))))

    return result
dataset/ETHPy150Open glue-viz/glue/glue/plugins/export_d3po.py/save_page/original