code: def unique_simplification(
      items: List[Dict[str, Any]], priority_keys: List[str]
  ) -> List[Dict[str, Any]]:
      """
      Given `items` (a list of dictionaries), remove any (key, value) pairs that
      aren't necessary to distinguish the items, removing the keys not in
      `priority_keys` and then from the end of `priority_keys` first.
  
      Example:
          items = [{"model": "M1", stop: "#", n: 3}, {"model": "M1", stop: "\n", n: 3}, {"model": "M2", stop: "\n", n: 3}]
          priority_keys = ["model"]
      Return:
          [{"model": "M1", stop: "#"}, {"model": "M1", stop: "\n"}, {"model": "M2"}]
      """
  
      def get_subitem(
          item: Dict[str, Any], subkeys: List[str]
      ) -> Dict[str, Any]:
          return {key: item.get(key) for key in subkeys}
  
      def get_keys(item: Dict[str, Any]) -> List[str]:
          """Return the keys of `item`, putting `priority_keys` first."""
          keys = []
          for key in priority_keys:
              if key in item:
                  keys.append(key)
          for key in item:
              if key not in priority_keys:
                  keys.append(key)
          return keys
  
      # Strip out common entries first
      items = without_common_entries(items)
  
      # Go through and remove more keys
      new_items: List[Dict[str, Any]] = []
      for item in items:
          # For each item, go through the keys in order
          keys = get_keys(item)
  
          for i in range(len(keys)):
              # For each prefix of the keys, keep it if it uniquely identifies
              # this item.
              subkeys = keys[: i + 1]
              subitem = get_subitem(item, subkeys)
              if (
                  sum(
                      1 if get_subitem(item2, subkeys) == subitem else 0
                      for item2 in items
                  )
                  == 1
              ):
                  item = subitem
                  break
          new_items.append(item)
  
      return new_items
  
imports: import json
  import os
  import shlex
  import subprocess
  import uuid
  import zstandard
  from typing import Any, Callable, Dict, List, Optional, TypeVar
  from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor
  from tqdm import tqdm
  import pyhocon
  from dataclasses import asdict, is_dataclass
  from helm.common.hierarchical_logger import hlog, htrack, htrack_block
label_desc: Use image node_id 20 for calling a global function with example usage: unique_simplification(items, priority_keys) and returns: new_items, unknown, keys