code: def model_deployments(model_name):
      model = base_controller.model.__dict__
  
      # get all data and extract unique model_version_id and deployment_version_id
      filter = {"model_id": model_name}
      all_data = datmo_monitoring.search_metadata(filter)
      model_version_ids = set(
          data["model_version_id"] for data in all_data
      )
      deployment_version_ids = set(
          data["deployment_version_id"] for data in all_data
      )
  
      # Get deployment information for each of the deployments
      deployments = []
      for deployment_version_id in deployment_version_ids:
          for model_version_id in model_version_ids:
              try:
                  deployment_info = (
                      datmo_monitoring.get_deployment_info(
                          deployment_version_id=deployment_version_id
                      )
                  )
              except:
                  break
              # Prettify dates
              deployment_info["created_at"] = prettify_datetime(
                  deployment_info["created_at"]
              )
              # TODO: replace with proper handling
              deployment_info["endpoints"] = [
                  endpoint
                  for endpoint in deployment_info["endpoints"]
                  if "".join(model_version_id.split("_")) in endpoint
              ]
              deployment_info["service_paths"] = [
                  path
                  for path in deployment_info["service_paths"]
                  if "".join(model_version_id.split("_")) in path
              ]
              # TODO: END
              deployment_info[
                  "deployment_version_id"
              ] = deployment_version_id
              deployment_info["model_version_id"] = model_version_id
              deployments.append(deployment_info)
  
      return render_template(
          "model_deployments.html",
          user=user,
          model=model,
          deployments=deployments,
      )
  
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 7 for calling a global function with example usage: model_deployments(model_name) and returns: render_template