code: def diskcache_put(table: str, key: Union[Dict, str, int], val: Any):
      if CACHELEVEL == 0:
          return val
      if isinstance(key, (str, int)):
          key = {"key": key}
      conn = db_connection()
      cur = conn.cursor()
      if table not in _db_tables:
          TYPES = {
              str: "text",
              bool: "integer",
              int: "integer",
              float: "numeric",
              bytes: "blob",
          }
          ltypes = ", ".join(
              f"{k} {TYPES[type(key[k])]}" for k in key.keys()
          )
          cur.execute(
              f"CREATE TABLE IF NOT EXISTS {table}_{VERSION} ({ltypes}, val blob, PRIMARY KEY ({', '.join(key.keys())}))"
          )
          _db_tables.add(table)
      cur.execute(
          f"REPLACE INTO {table}_{VERSION} ({', '.join(key.keys())}, val) VALUES ({', '.join(['?']*len(key.keys()))}, ?)",
          tuple(key.values()) + (pickle.dumps(val),),
      )  # noqa: E501
      conn.commit()
      cur.close()
      return val
  
imports: from __future__ import annotations
  import os, functools, platform, time, re, contextlib, operator, hashlib, pickle, sqlite3, cProfile, pstats, tempfile, pathlib, string, ctypes
  from urllib import request
  from tqdm import tqdm
  from typing import Dict, Tuple, Union, List, ClassVar, Optional, Iterable, Any, TypeVar, TYPE_CHECKING, Callable, Sequence
label_desc: Use image node_id 27 for calling a global function with example usage: diskcache_put(table, key, val) and returns: val, val