code: def stream(alt_spec, exceptions=None, resize=False, reuse=False):
      """
      Send an Altair specification to the notebook using the streaming API
  
      Parameters
      ----------
      alt_spec : top-level chart object such as Chart or LayeredChart
          the Altair specification
      exceptions : list
          a list of dataframes of id(dataframe) that should be inlined.
          A small dataframe does not benefit from the streaming API.
          A geopandas dataframe is also not compressed anyway. If you send
          one of these, you can put them in the exception list to save
          some cycles.
      reuse : boolean
          if True, return the context dictionary and the widget. The
          context dictionary associate a dataframe id with a pair
          (name, data). The name is useful to reuse the widget for
          streaming more data using the widget `.update` method.
      resize: boolean
          Resize vega component after sending the update. Some charts
          need it, others don't. Defaults to True but can be overridden
          here.
      reuse: boolean
          Return the context and widget if True, None otherwise.
          The context and widget are useful to stream multiple times
          to the same widget. If the `stream` function is used to speed
          up the dataset transfer once and for all (the default),
          there is no need to return the context and widget. It would
          leave a useless value in a notebook cell.
  
      Returns
      -------
      If the `reuse` parameter is False, return None. Otherwise, return
      a pair containing:
      The context, a dictionary updated by alt.data_transformers.enable,
      and the VegaWidget created to display the alt_spec, to be able to
      update it later.
      """
      context = {}
      with alt.data_transformers.enable(
          "streaming", context=context, exceptions=exceptions
      ):
          widget = VegaWidget(alt_spec.to_dict())
          display(widget)
          for name_data in context.values():
              name, data = name_data
              widget.update(
                  name, remove="true", insert=data, resize=resize
              )
      if reuse:
          return context, widget
      return None
  
file_path: ipyvega/vega/altair.py
imports: import warnings
  import logging
  from toolz import curried
  from IPython.display import display
  import pandas
  import altair
  from .widget import VegaWidget
label_desc: Use image node_id 3 for calling a global function with example usage: stream(alt_spec, exceptions, resize, reuse) and returns: None, context,  widget