code: def identify_code_blocks(blocks: List[Page]):
      code_block_count = 0
      font_info = None
      for p in blocks:
          stats = p.get_font_stats()
          if font_info is None:
              font_info = stats
          else:
              font_info += stats
      try:
          most_common_font = font_info.most_common(1)[0][0]
      except IndexError:
          print(f"Could not find most common font")
          most_common_font = None
  
      last_block = None
      for page in blocks:
          try:
              min_start = page.get_min_line_start()
          except IndexError:
              continue
  
          for block in page.blocks:
              if block.most_common_block_type() != "Text":
                  last_block = block
                  continue
  
              is_indent = []
              line_fonts = []
              for line in block.lines:
                  fonts = [span.font for span in line.spans]
                  line_fonts += fonts
                  line_start = line.bbox[0]
                  if line_start > min_start:
                      is_indent.append(True)
                  else:
                      is_indent.append(False)
              comment_lines = comment_count(
                  [line.prelim_text for line in block.lines]
              )
              is_code = [
                  len(block.lines) > 3,
                  sum([f != most_common_font for f in line_fonts])
                  > len(line_fonts)
                  * 0.8,  # At least 80% of the fonts are not the most common, since code usually uses a different font from the main body text
                  is_code_linelen(block.lines),
                  (
                      sum(is_indent) > len(block.lines) * 0.2
                      or comment_lines > len(block.lines) * 0.2
                  ),  # 20% lines indented or 20% of the lines are comments
              ]
  
              # Check if previous block is code, and this block is indented
              is_code_prev = [
                  last_block
                  and last_block.most_common_block_type() == "Code",
                  sum(is_indent)
                  >= len(block.lines) * 0.8,  # At least 80% indented
              ]
  
              if all(is_code) or all(is_code_prev):
                  code_block_count += 1
                  block.set_block_type("Code")
  
              last_block = block
      return code_block_count
  
imports: from marker.schema import Span, Line, Page
  import re
  from typing import List
  import fitz
label_desc: Use image node_id 3 for calling a global function with example usage: identify_code_blocks(blocks) and returns: code_block_count