def create_and_build(builder_class, *data, **kws):
    if getattr(builder_class, 'dimensions') is None:
        raise NotImplementedError('Each builder must specify its dimensions, %s does not.' % builder_class.__name__)

    if getattr(builder_class, 'default_attributes') is None:
        raise NotImplementedError('Each builder must specify its default_attributes, %s does not.' % builder_class.__name__)

    builder_props = set(builder_class.properties()) | \
        set(getattr(builder_class, "__deprecated_attributes__", []))

    # append dimensions to the builder props
    for dim in builder_class.dimensions:
        builder_props.add(dim)

    # append attributes to the builder props
    for attr_name in builder_class.default_attributes.keys():
        builder_props.add(attr_name)

    # create the new builder
    builder_kws = {k: v for k, v in kws.items() if k in builder_props}
    builder = builder_class(*data, **builder_kws)

    # create a chart to return, since there isn't one already
    chart_kws = { k:v for k,v in kws.items() if k not in builder_props}
    chart = Chart(**chart_kws)
    chart.add_builder(builder)
    chart.start_plot()

    curdoc()._current_plot = chart # TODO (havocp) store this on state, not doc?
    if curstate().autoadd:
        curdoc().add_root(chart)

    return chart
A factory function for handling Chart and Builder generation.
dataset/ETHPy150Open bokeh/bokeh/bokeh/charts/builder.py/create_and_build