code: def model_snapshots(model_name):
      model = base_controller.model.__dict__
      if model_name == model["name"]:
          snapshots = base_controller.dal.snapshot.query(
              {"model_id": model["id"]}
          )
          snapshots = [
              (snapshot, snapshot.to_dictionary(stringify=True))
              for snapshot in snapshots
          ]
      else:
          snapshots = []
      config_keys = set(
          item
          for sublist in [
              snapshot[0].__dict__["config"].keys()
              for snapshot in snapshots
          ]
          for item in sublist
      )
      stats_keys = set(
          item
          for sublist in [
              snapshot[0].__dict__["stats"].keys()
              for snapshot in snapshots
          ]
          for item in sublist
      )
      return render_template(
          "model_snapshots.html",
          user=user,
          model=model,
          snapshots=snapshots,
          config_keys=config_keys,
          stats_keys=stats_keys,
      )
  
imports: import os
  import shutil
  import uuid
  import json
  from flask import Flask, url_for
  from flask import render_template, request, jsonify
  import plotly
  from datetime import datetime
  from datmo.config import Config
  from datmo.core.entity.run import Run
  from datmo.core.controller.base import BaseController
  from datmo.core.util.misc_functions import prettify_datetime, printable_object
label_desc: Use image node_id 4 for calling a global function with example usage: model_snapshots(model_name) and returns: render_template