code: def append_leaves(
      new_line: Line,
      old_line: Line,
      leaves: List[Leaf],
      preformatted: bool = False,
  ) -> None:
      """
      Append leaves (taken from @old_line) to @new_line, making sure to fix the
      underlying Node structure where appropriate.
  
      All of the leaves in @leaves are duplicated. The duplicates are then
      appended to @new_line and used to replace their originals in the underlying
      Node structure. Any comments attached to the old leaves are reattached to
      the new leaves.
  
      Pre-conditions:
          set(@leaves) is a subset of set(@old_line.leaves).
      """
      for old_leaf in leaves:
          new_leaf = Leaf(old_leaf.type, old_leaf.value)
          replace_child(old_leaf, new_leaf)
          new_line.append(new_leaf, preformatted=preformatted)
  
          for comment_leaf in old_line.comments_after(old_leaf):
              new_line.append(comment_leaf, preformatted=True)
  
imports: import itertools
  import math
  from dataclasses import dataclass, field
  from typing import Callable, Dict, Iterator, List, Optional, Sequence, Tuple, TypeVar, Union, cast
  from black.brackets import COMMA_PRIORITY, DOT_PRIORITY, BracketTracker
  from black.mode import Mode, Preview
  from black.nodes import BRACKETS, CLOSING_BRACKETS, OPENING_BRACKETS, STANDALONE_COMMENT, TEST_DESCENDANTS, child_towards, is_docstring, is_funcdef, is_import, is_multiline_string, is_one_sequence_between, is_type_comment, is_type_ignore_comment, is_with_or_async_with_stmt, make_simple_prefix, replace_child, syms, whitespace
  from black.strings import str_width
  from blib2to3.pgen2 import token
  from blib2to3.pytree import Leaf, Node
label_desc: Use image node_id 2 for calling a global function with example usage: append_leaves(new_line, old_line, leaves, preformatted) without return types