code: def replace_child(old_child: LN, new_child: LN) -> None:
      """
      Side Effects:
          * If @old_child.parent is set, replace @old_child with @new_child in
          @old_child's underlying Node structure.
              OR
          * Otherwise, this function does nothing.
      """
      parent = old_child.parent
      if not parent:
          return
  
      child_idx = old_child.remove()
      if child_idx is not None:
          parent.insert_child(child_idx, new_child)
  
imports: import sys
  from typing import Final, Generic, Iterator, List, Optional, Set, Tuple, TypeVar, Union
  from mypy_extensions import mypyc_attr
  from black.cache import CACHE_DIR
  from black.mode import Mode, Preview
  from black.strings import get_string_prefix, has_triple_quotes
  from blib2to3 import pygram
  from blib2to3.pgen2 import token
  from blib2to3.pytree import NL, Leaf, Node, type_repr
label_desc: Use image node_id 7 for calling a global function with example usage: replace_child(old_child, new_child) without return types