code: def assemble_exception_table(tab: List[ExceptionTableEntry]) -> bytes:
      """
      Inverse of parse_exception_table - encodes list of exception
      table entries into bytes.
      """
      b = []
      for entry in tab:
          first_entry = encode_exception_table_varint(entry.start // 2)
          first_entry[0] |= 1 << 7
          b.extend(first_entry)
          length = entry.end - entry.start + 2
          b.extend(encode_exception_table_varint(length // 2))
          b.extend(encode_exception_table_varint(entry.target // 2))
          dl = (entry.depth << 1) + entry.lasti
          b.extend(encode_exception_table_varint(dl))
      return bytes(b)
  
imports: import copy
  import dataclasses
  import dis
  import itertools
  import sys
  import types
  from typing import Any, Callable, cast, Dict, Iterator, List, Optional, Tuple
  from .bytecode_analysis import get_indexof, propagate_line_nums, remove_extra_line_nums, stacksize_analysis
label_desc: Use image node_id 17 for calling a global function with example usage: assemble_exception_table(tab) and returns: bytes