code: def replace_key(d: dict, old_key, new_key, exist_ok=False):
      """Replace an old key with a new key (in-place)"""
      if not exist_ok:
          assert new_key not in d
      d[new_key] = d.pop(old_key)
  
imports: import math
  import itertools
  from dataclasses import replace
  from typing import Mapping, Any, Sequence, Iterable, Iterator, Union, Tuple, Dict, Set
label_desc: Use image node_id 8 for calling a global function with example usage: replace_key(d, old_key, new_key, exist_ok) without return types