code: def write_plot(vizlib, plot, plot_type, tag, directory=None):
      r"""Save the plot to a file, or display it interactively.
  
      Parameters
      ----------
      vizlib : str
          The visualization library: ``'matplotlib'``, ``'seaborn'``,
          or ``'bokeh'``.
      plot : module
          Plotting context, e.g., ``plt``.
      plot_type : str
          Type of plot to generate.
      tag : str
          Unique identifier for the plot.
      directory : str, optional
          The full specification for the directory location. if
          ``directory`` is *None*, then the plot is displayed
          interactively.
  
      Returns
      -------
      None : None.
  
      Raises
      ------
      ValueError
          Unrecognized data visualization library.
  
      References
      ----------
  
      Visualization Libraries:
  
      * Matplotlib : http://matplotlib.org/
      * Seaborn : https://seaborn.pydata.org/
      * Bokeh : http://bokeh.pydata.org/en/latest/
  
      """
  
      # Validate visualization library
  
      if (
          vizlib == "matplotlib"
          or vizlib == "seaborn"
          or vizlib == "bokeh"
      ):
          # supported library
          pass
      elif vizlib == "plotly":
          raise ValueError(
              "Unsupported data visualization library: %s" % vizlib
          )
      else:
          raise ValueError(
              "Unrecognized data visualization library: %s" % vizlib
          )
  
      # Save or display the plot
  
      if directory:
          if vizlib == "bokeh":
              file_only = "".join([plot_type, USEP, tag, ".html"])
          else:
              file_only = "".join([plot_type, USEP, tag, ".png"])
          file_all = SSEP.join([directory, file_only])
          logger.info("Writing plot to %s", file_all)
          if vizlib == "matplotlib":
              plot.tight_layout()
              plot.savefig(file_all)
          elif vizlib == "seaborn":
              plot.savefig(file_all)
          else:
              output_file(file_all, title=tag)
              show(plot)
      else:
          if vizlib == "bokeh":
              show(plot)
          else:
              plot.plot()
  
imports: from alphapy.estimators import get_estimators
  from alphapy.globals import BSEP, PSEP, SSEP, USEP
  from alphapy.globals import ModelType
  from alphapy.globals import Partition, datasets
  from alphapy.globals import Q1, Q3
  from alphapy.utilities import remove_list_items
  from bokeh.plotting import figure, show, output_file
  import itertools
  import logging
  import math
  import matplotlib
  import matplotlib.pyplot
  from mpl_toolkits.mplot3d import Axes3D
  import numpy
  import pandas
  from scipy import interp
  import seaborn
  from sklearn.calibration import calibration_curve
  from sklearn.inspection import partial_dependence
  from sklearn.inspection import plot_partial_dependence
  from sklearn.metrics import auc
  from sklearn.metrics import confusion_matrix
  from sklearn.metrics import roc_curve
  from sklearn.model_selection import cross_val_score
  from sklearn.model_selection import learning_curve
  from sklearn.model_selection import StratifiedKFold
  from sklearn.model_selection import train_test_split
  from sklearn.model_selection import validation_curve
  from sklearn.utils.multiclass import unique_labels
label_desc: Use image node_id 4 for calling a global function with example usage: write_plot(vizlib, plot, plot_type, tag, directory) without return types