code: def print_xref(doc, xref):
      """Print an object given by XREF number.
  
      Simulate the PDF source in "pretty" format.
      For a stream also print its size.
      """
      print("%i 0 obj" % xref)
      xref_str = doc.xref_object(xref)
      print(xref_str)
      if doc.xref_is_stream(xref):
          temp = xref_str.split()
          try:
              idx = temp.index("/Length") + 1
              size = temp[idx]
              if size.endswith("0 R"):
                  size = "unknown"
          except:
              size = "unknown"
          print("stream\n...%s bytes" % size)
          print("endstream")
      print("endobj")
  
imports: import argparse
  import bisect
  import os
  import sys
  import statistics
  from typing import Dict, List, Set, Tuple
  import fitz
  from fitz.fitz import TEXT_INHIBIT_SPACES, TEXT_PRESERVE_LIGATURES, TEXT_PRESERVE_WHITESPACE
label_desc: Use image node_id 4 for calling a global function with example usage: print_xref(doc, xref) without return types