code: def plot_model(
      model,
      to_file="model.png",
      show_shapes=False,
      show_layer_names=True,
      show_precision=False,
      rankdir="TB",
      dpi=96,
  ):
      """Converts a HLS model to dot format and save to a file.
  
      Arguments:
          model: A HLS model instance
          to_file: File name of the plot image.
          show_shapes: whether to display shape information.
          show_layer_names: whether to display layer names.
          show_precision: whether to display precision of layer's variables.
          rankdir: `rankdir` argument passed to PyDot,
              a string specifying the format of the plot:
              'TB' creates a vertical plot;
              'LR' creates a horizontal plot.
          dpi: Dots per inch.
  
      Returns:
          A Jupyter notebook Image object if Jupyter is installed.
          This enables in-line display of the model plots in notebooks.
      """
      dot = model_to_dot(
          model,
          show_shapes=show_shapes,
          show_layer_names=show_layer_names,
          show_precision=show_precision,
          rankdir=rankdir,
          dpi=dpi,
      )
      if dot is None:
          return
  
      if to_file is not None:
          _, extension = os.path.splitext(to_file)
          if not extension:
              extension = "png"
          else:
              extension = extension[1:]
          # Save image to disk.
          dot.write(to_file, format=extension)
      else:
          # Return the image as a Jupyter Image object, to be displayed in-line.
          # Note that we cannot easily detect whether the code is running in a
          # notebook, and thus we always return the Image if Jupyter is available.
          try:
              import tempfile
  
              from IPython import display
  
              temp = tempfile.NamedTemporaryFile(suffix=".png")
              dot.write(temp.name, format="png")
              return display.Image(filename=temp.name)
          except ImportError:
              pass
  
imports: import os
  import sys
label_desc: Use image node_id 4 for calling a global function with example usage: plot_model(model, to_file, show_shapes, show_layer_names, show_precision, rankdir, dpi) and returns: display