code: def visualize(cls, a_dict: dict, by_min=False):
      if len(a_dict) == 0:
          return a_dict
      sorted_values = sorted(a_dict.values(), reverse=not by_min)
      best_v, worst_v = sorted_values[0], sorted_values[-1]
      result = {}
      for k, v in a_dict.items():
          if v == best_v:
              result[k] = Markup(cls.BEST_MD_TEMPLATE.format(v))
          elif v == worst_v:
              result[k] = Markup(cls.WORSE_MD_TEMPLATE.format(v))
          else:
              result[k] = str(v)
      return result
  
imports: from jinja2 import Markup
label_desc: Use image node_id 1 for calling the VizSeqDictVisualizer obj's underlying member method code with example usage: obj.visualize(cls, a_dict, by_min) and returns: result, a_dict