code: def down(db, dataset_name):
      match_d = {"name": dataset_name}
      dataset_dict = db.datasets.find_one(match_d)
  
      sample_collection_name = dataset_dict.get(
          "sample_collection_name", None
      )
      frame_collection_name = dataset_dict.get(
          "frame_collection_name", None
      )
      if sample_collection_name and not frame_collection_name:
          dataset_dict["frame_collection_name"] = (
              "frames." + sample_collection_name
          )
  
      app_config = dataset_dict.get("app_config", None)
      if app_config is not None:
          sidebar_groups = app_config.get("sidebar_groups", None)
          if sidebar_groups is not None:
              tags_idx = None
              found_label_tags = False
  
              for idx, sidebar_group in enumerate(sidebar_groups):
                  name = sidebar_group.get("name", None)
  
                  if name == "tags":
                      sidebar_group["paths"] = []
                      tags_idx = idx
  
                  if name == "label tags":
                      sidebar_group["paths"] = []
                      found_label_tags = True
  
              if tags_idx is not None and not found_label_tags:
                  sidebar_groups.insert(
                      tags_idx + 1,
                      {"name": "label tags", "paths": []},
                  )
  
      _update_runs(
          db,
          dataset_dict,
          "brain_methods",
          {"cls": _NEW_SKLEARN_CONFIG_CLS},
          {"cls": _OLD_SKLEARN_CONFIG_CLS, "method": "similarity"},
          {"cls": _OLD_SKLEARN_RESULTS_CLS},
      )
  
      db.datasets.replace_one(match_d, dataset_dict)
  
imports: from bson import json_util
  import gridfs
label_desc: Use image node_id 2 for calling a global function with example usage: down(db, dataset_name) without return types